Dew924
Dew924

Reputation: 11

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

Upvotes: 1

Views: 2686

Answers (2)

Nicholas Daley-Okoye
Nicholas Daley-Okoye

Reputation: 2397

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

Upvotes: 1

Rakesh
Rakesh

Reputation: 1575

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

Upvotes: 4

Related Questions