Suite teardown and --RunEmptySuite command option

Hello community,

I have a test suite which should not be run, based on tags in it. The test suite doesn’t have suite setup but it has suite teardown.
However, if my robot command includes option --RunEmptySuite, the suite teardown of the test suite will be run. I would expect that the suite teardown is not run.

How could I avoid running the suite teardown in this case and still having --RunEmptySuite option in use?

Hi Sami,

It seems RF is doing what you told it to do… you told it to --RunEmptySuite even though no tests match so the only thing that did match was the teardown so that was executed.

What does the teardown do? logoff?

What you might need to do is put an IF statement in the teardown to only run if a test in that suite was run but the trick is going to be how do you detect that?

  • do all the tests in this suite have a common tag? if so you might be able to use one of the Automatic variables to detect if the tag was included/excluded
    • ${OPTIONS.exclude} (–exclude)
    • ${OPTIONS.include} (–include)
  • if all the test have a common test setup or a couple of common common test setup, then set a suite variable in the *** variables *** section to false, then in the test setups set it to true, then you can use this variable to run the teardown if true
  • if no test setups, then consider making a common test setup to do the previous point, otherwise just use set variable to set it true and add this line to all the tests

Another approach is to remove the suite teardown and add a teardown keyword as a test teardown to each of the tests

Sorry this is all generic but without more details of situation this is the best I can suggest.



Thank you Dave for your response.
I am running tests for an embedded system. I run tests either using USB or serial port and some test suites are meant to run only either of those.
In my case if the test suite is tagged for USB only and despite that it will be executed when using the serial port tag. Then the suite teardown gets executed and it will cause problems for the rest of the test execution.

I have understood that when a test suite is tagged (using Test Tags) not to be executed then nothing including suite setup and suite teardown in the test suite will be executed.
But it seems that it is not how tagged based exclusion works so then I just need to modify my test suite.

Hi Sami,

My understanding is generally this would be true except when you override this by using --RunEmptySuite

Another better option might be to put all the USB only tests into a usb.robot file, all the serial port only tests into a serial.robot, then the common tests into a usb_serial.robot file, then you can simply select which files you want with buy using Simple patterns to select the correct files i.e.

robot *usb*.robot


robot *serial*.robot

Then you won’t need --RunEmptySuite as you should never encounter a situation where a file is selected but no tests run from that file. This will save you modifying all the tests, just copy and paste them to the right files (or you could do the same with folders)

Hopefully that’ll work better for you,



I ended up to skip both Suite Setup and Suite Teardown if needed based on tags.


1 Like