What do the numbers before test testcase in Test lab indicate? - hp-quality-center

What do the numbers before test testcase in Test lab indicate? For example:
[1]Login with ur……
What does the [1] mean?

the [1] before the test case in the test lab indicates the number of occurrences of that test case. If you add the same test case twice it will look something like this.
[1] Test Case Name
[2] Test Case Name

it's the number of instances of that test case in the Execution Grid.
each time you add this test case to the grid you get a new instance added with a new number beside it.

It took me a while to understand instances of test 'cases'. I was thinking of it all wrong (because the test lab is where you run the tests, right?).
When you want a specific set of parameters for a test, use test configurations in the Test Plan.
Once the values are set, you create your instance in the Test Lab from the configuration so that you can execute it.
If, on the other hand, you have an instance in Test Lab with some specific values that you like, you can use right-click -> generate configuration.
This creates a configuration for you and you can give it a name of your choosing (something that I really wanted to do in the test lab, until I discovered how Configurations work).
There is also a button in the test plan configurations tab to 'push' updated values to the Test Lab. So while there is a disconnect between configurations and test lab (by design), but it is not such a disconnect that you can't connect them when you want.

Related

How to run JUnit test last - like #Order(999)

I have 20 tests in one class but one test need to run last. Is there any option how to achieve that? Like annotation #Order(Last) or #Order(999)
Best what I can do is to mark all tests method with #Order(19) to #Order(19) and test that need run last have #Order(100)

Defining setup, teardown and variable in argumentfile in robotframework

Basically 2 issues:
1. I plan to execute multiple test cases from argument file. The structure would look like that:
SOME_PATH/
-test_cases/
-some_keywords/
-argumentfile.txt
How should i define a suite setup and teardown for all those test cases executed from file (-A file)?
From what i know:
a) I could execute it in file with 1st and last test case, but the order of test cases may change so it is not desired.
b) provide it in init.robot and put it somewhere without test cases only to get the setup and teardown. This is because if I execute:
robot -i SOME_TAG -A argumentfile /path/to/init
and the init is in test_case folder it will execute the test_cases with a specific tag + those in a folder twice.
Is there any better way? Provide it, for example, in argumentfile?
2 How to provide PATH variable in argumentfiles in robotframework?
I know there is possibility to do:
--variable PATH:some/path/to/files
but is it not for test suite env?
How to get that variable to be visible in the file itself: ${PATH}/test_case_1.robot
For your 2nd question, you could create a temporary environment variable that you'd then use. Depending on the OS you're using, the way you'll do this will be different:
Windows:
set TESTS_PATH=some/path/here
robot -t %TESTS_PATH%/test_case_1.robot
Unix:
export TESTS_PATH="some/path/here"
robot -t $TESTS_PATH/test_case_1.robot
PS: you might want to avoid asking multiple, different questions in the same thread

RED Robot Editor - One TestCase Dependent To Other [duplicate]

I have a large number of test cases, in which several test cases are interdependent. Is it possible that while a later test case is getting executed you can find out the status of a previously executed test case?
In my case, the 99th test case depends on the status of some prior test cases and thus, if either the 24th or the 38th fails I would like the 99th test case NOT to get executed at all and thus save me a lot of time.
Kindly, explain with some example if possible. Thanks in advance!
Robot is very extensible, and a feature that was introduced in version 2.8.5 makes it easy to write a keyword that will fail if another test has failed. This feature is the ability for a library to act as a listener. With this, a library can keep track of the pass/fail status of each test. With that knowledge, you can create a keyword that fails immediately if some other test fails.
The basic idea is, cache the pass/fail status as each test finishes (via the special _end_test method). Then, use this value to determine whether to fail immediately or not.
Here's an example of how to use such a keyword:
*** Settings ***
Library /path/to/DependencyLibrary.py
*** Test Cases ***
Example of a failing test
fail this test has failed
Example of a dependent test
[Setup] | Require test case | Example of a failing test
log | hello, world
Here is the library definition:
from robot.libraries.BuiltIn import BuiltIn
class DependencyLibrary(object):
ROBOT_LISTENER_API_VERSION = 2
ROBOT_LIBRARY_SCOPE = "GLOBAL"
def __init__(self):
self.ROBOT_LIBRARY_LISTENER = self
self.test_status = {}
def require_test_case(self, name):
key = name.lower()
if (key not in self.test_status):
BuiltIn().fail("required test case can't be found: '%s'" % name)
if (self.test_status[key] != "PASS"):
BuiltIn().fail("required test case failed: '%s'" % name)
return True
def _end_test(self, name, attrs):
self.test_status[name.lower()] = attrs["status"]
To solve this problem I'm using something like this:
Run Keyword if '${PREV TEST STATUS}'=='PASSED' myKeyword
so maybe this will be usable also for you.

How to split robot testcases using colon, so that each will be treated as separate testcase?

I have 3 test cases which will test the same functionality. It will use same keywords as shown below.
Instead of writing three different test cases "test-1151,test-2125,test-2126", I want to write one test case separated with colons as shown below. But robot should treat this as three seperate test case and it should show pass/fail test case count accordingly.
test.robot:
*** Settings ***
Library lib.test
*** Variables ***
*** Keywords ***
*** Test Cases ***
test-1151:test-2125:test-2126
[Documentation] test_sample
[Tags] sanity
Install Adobe software
Launch the app
If I run the above robot file, robot is taking "test-1151:test-2125:test-2126" as one test case. How to tell robot to treat this as three different test cases (separated with colon)?
Why don't you turn the detail of the test case into a keyword? Then write three test cases that call the keyword?
This might be an alternative option for you:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#data-driven-style
Basically have one test template which would be the same, maybe have some arguments for parameters that will change based on test cases. You can then have many test cases doing exactly the same or slightly different things in a short and concise notation.
It's unclear what your real goals are. It seems that you want to see three items in the report, "test-1151", "test-2125", and "test-2126", but that you actually only want to run that test once.
I'm guessing that those names correspond to either a test plan or an item in a ticketing system of some sort.
My recommendation is to use tags to tag your test. You can give the test any name you want, and then give it tags for the names you want to see in the report. Once the test runs, the report can give you statistics based on tag.
For example:
test-1151:test-2125:test-2126
[Documentation] test_sample
[Tags] sanity test-1151 test-2125 test-2126
Install Adobe software
Launch the app
To answer your specific question of whether you can have this one test reported three times, the answer is "no". It will show up in the logs and report as a single test. However, the report also includes test status by tag, so you will see one item in the report for each tag.

How to run tests in random order with robotframework maven plugin?

I am trying to run Robotframework testcases from eclipse with Robotframework-maven plugin. Can anyone tell me the configuration of POM.xml to run the testcases according to my given order instead of alphabetical order? For example, I have the following tags in the corresponding test suites:
TestSuit1--->
Testcase1.robot -- >MyTestcase1 [Tags] a
Testcase2.robot --- >MyTestcase2 [Tags] b
Testcase3.robot -- - > MyTestcase3 [Tags] c
I want to executes the above test cases random order. If I write in pom.xml
<includes_cli>b,a,c</includes_cli>
It executes the tests according to alphabetical order instead of my given order. Can anyone have a solution for that?
Br,
Dew
You can use --randomize option to execute the test cases in random order as below:
Case 1:
robot --randomize tests <Testcase1.robot>
tests: Test cases inside each test suite will be executed in random order
Case 2:
robot --randomize suites <path/to/Testsuite>
suites: All test suites will be executed in a random order, but test cases inside suites will run in the order they are defined
It looks like the latest version of the maven plugin has a randomize option:
http://robotframework.org/MavenPlugin/run-mojo.html#randomize
options are:
<randomize>all</randomize>
<randomize>suite</randomize>
<randomize>test</randomize>
with the default being no randomization.
Looks like the same options as for the --randomize command line argument for the robot command:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#randomizing-execution-order

Resources