Sarada Akurathi
Sarada Akurathi

Reputation: 1188

how to run specific tests from different suites in robotframework

I have created 2 different suites using robot framework say

TestSuite1 which has tests
      TestCase1
      TestCase2

TestSuite2 which has tests
      TestCase3
      TestCase4

Now, I want to run Testcases in the following order

TestSuite2\TestCase4
TestSuite1\TestCase1
TestSuite1\TestCase2
TestSuite2\TestCase3

When I have searched in stack over flow forum, i got two different answers which are

Answer 1: create a Argument file with the suites names in which order want to run and run

Argument_File.txt
-----------------
TestSuite2
TestSuite1

pybot -A Argument_File.txt

Answer 2: To run specific test in a suite give the command

robot --test TestCase1 TestSuite1

But my purpose is different, i want to run the different testcases in different suites together in the order i wish.

Can anyone help me on this.

Thanks Sarada

Upvotes: 1

Views: 4757

Answers (4)

Sarada Akurathi
Sarada Akurathi

Reputation: 1188

I found exact near functionality exist in RED plugin.

Install Eclipse (Mars or above version) + RED + RobotFramework-EclipseIDE

pom.xml --> right click --> Run As --> Run Configurations 

Here we can select the test cases under different test suites.

but as waman mentioned, it will be one test suite after another.

Upvotes: 0

user6731023
user6731023

Reputation:

You can add tags to each test cases in your suite. Now, give same tag name to you second suite and while executing include this tag and run. Example: I have created two suites

Suite1
Test1
[Tags]  x  y

Test2
[Tags]  z  w


Suite2
Test1
[Tags]  w  y

Test2
[Tags]  x  z

And these suites are under some folder 'folder_1'. Now, if you want to run all the test cases which have tag x just type as below

pybot -i x folder_1

This will execute test1 from suite 1 and test 2 from suite 2.

Upvotes: 0

Waman
Waman

Reputation: 1179

Argument file

--include <tags>
<Suite1> 
<Suite2>
<Suite3>

This should run tests tagged with similar name across all your suites.

Hope it helps!

Upvotes: 1

Bryan Oakley
Bryan Oakley

Reputation: 385970

You can't do what you want. All the tests in one suite will run before any tests in the next suite.

Upvotes: 0

Related Questions