Jeff
Jeff

Reputation: 21

Executing separate test case robot files from a single file

From my interpretation of what I have read in the robot framework documentation I think what I want to do is possible, but the examples given were vague at best.

I have written each of my tests as a separate robot file due to some external setup/tear down requirements and placed them in a directory - i.e.:

| --/TestMyJobs
    |
    | --TestJob_UnHappyPath_1.robot
    | --TestJob_UnHappyPath_2.robot
    | --TestJob_HappyPath_1.robot

The ultimate goal is to:

  1. do the external setup
  2. run all of the UnHappyPath tests
  3. do the external tear down
  4. do external setup again
  5. run the HappyPath job
  6. do external tear down again
  7. review the results

I see examples of how to run all of the robot files in a given directory by specifying a path to the directory where the tests are located. If I understand the examples I would enter the following on the command line: robot ~/TestMyJobs/ and all of the robot files in that directory would be executed. It is not exactly what I want, but I guess I could live with it if it were absolutely necessary.

Any suggestions on how to run only specific suite files or test cases instead of everything inside the said directory?

Thanks. Jeff

Upvotes: 0

Views: 1164

Answers (1)

Morkkis
Morkkis

Reputation: 495

In the Robot Framework User Guide there's actually a list of all the possible commandline options you can use.

Given that the external setup is not done in any of the Robot files, you can simply use the options -s and -t to define the Suite file or Test Case to run respectively.

For example

robot -s TestJob_UnHappyPath_1 ~\TestMyJobs

would run only the mentioned Test Suite file.

For a single test you'd use

robot -t "My Test name has spaces" ~\TestMyJobs

Also if there's a possibility that there is a test with same name in multiple files, you can use both options at the same time.

Upvotes: 0

Related Questions