Is there a way to get Robot Framework to run test suites in a certain order?

Calyth picture Calyth · May 1, 2013 · Viewed 30.9k times · Source

Suppose I have 2 test suites in the local directory, foo and bar, and I want to run the test suite in the order of foo then bar.

I tried to run pybot -s foo -s bar ., but then it just goes and run bar then foo (i.e. in alphabetical order).

Is there a way to get pybot to run robot framework suites to be execute in the order that I define?

Answer

sjudǝʊ picture sjudǝʊ · Jul 22, 2014

Robot framework can use argument files that can be used to specify order of execution (docs):

This is from older docs (not online anymore):

Another important usage for argument files is specifying input files or directories in certain order. This can be very useful if the alphabetical default execution order is not suitable:

Basically, you create something similar to start up script.

--name My Example Tests
tests/some_tests.html
tests/second.html
tests/more/tests.html
tests/more/another.html
tests/even_more_tests.html

There is neat feature that from argument file you can call another argument file that can override previously set parameters. Execution is recursive, so you can nest as many argument files as you need

Another option would be to use start up script. Than you have to deal with other aspects like which operating system you are running test on. You could also use python for starting up script on multiple platforms. There is more in this section of docs