Select test cases by custom function

It is possible to filter/select test cases within the search path by defining test case names (-t “test name”) or by tags (-i “run tag” -e “ignore tag”).
I’d like to select tests by a test plan supplied by another tool (Jama, in our case).

A list of test case names and Jama global ids can be downloaded from a specific Jama test plan and stored in a json file. The test cases within the Robot scripts have the same names and should also have a reference to the Jama global id within the [Documentation] section.
So, I want to load the json file and check each test case within the search path against the set of test case names and global ids. If a test case name and global id is not on that list, I want to remove it from the execution plan (like if it had a tag that is excluded with the -e parameter). There should be a warning (on console and within output.xml and log.html), if only the test case name or the global id is on that list.

Is there a way to deploy such a filter method on startup?
Thanks in advance!

Hi Oliver,

Can you simply add the Jama global id as an extra tag on your robot test cases? if you do that then you can simply use the “global id” tags to control what is executed.

Hope that helps,


Hi Dave,

no, I can’t do this. There is a pool of tests and we need to select a subset for each project. We do not want to put tags anywhere in addition to the work we have maintaining the test pans in Jama.

Best regards,


Hi Oliver,

Another thing I can suggest is that you can pass the options to the robot command multiple times, so the code you use to parse the Jama test plan json file can construct a list of test names and then call robot with multiple -t options

e.g. if your test plan specifies test_1, test_2, test_3, test_4, test_5, test_6, test_7 and test_8 then you would produce a command line like:

robot -t test_1 -t test_2 -t test_3 -t test_4 -t test_5 -t test_6 -t test_7 -t test_8

Not sure if there is a limit to how many you can do this with

-t also accepts wildcards like * and ?

Will that work for you?


Hello Dave,

yeah, I think of that as a backup plan. I’d write a script to parse the list and build a massive robot call with hundreds or even thousands of -t parameters.

Another idea is to implement my own using an alternative TestSuiteBuilder class.



Hi Oliver,

Yeah I think your own might be your best bet, good luck.