How to know in suite setup which tests will be executed

Is it possible to know in custom suite setup keyword which tests from that suite will be executed? Let’s say I want to prepare some files there, one per test. But if the params combination will make only one test case to be executed then I would like in suite setup to prepare a file only for this single test case. How I could do this?

Hi Adrian,

I’ve not seen anything in the documentation that would give that information.

There is however Test setup and teardown might give you what you need, on each test define a Test setup that creates just the file needed for that test.

This could be still the same custom keyword as you have now, just add an argument to specify which file to create and pass that argument when calling the Test setup

Something like this:

*** Test Cases ***
Test Case A
    [Setup]    Create Data File    File A
    Do Something

Test Case B
    [Setup]    Create Data File    File B
    Do Something

Test Case C
    [Setup]    Create Data File    File C
    Do Something

Hope that helps,


The listener interface allows you to get notifications about events during execution. Listeners are typically enabled from the command line, but libraries can register them as well. For more information see the User Guide.

1 Like

I’ve created a python script which returns test cases executed in the current test run and which can be called in suite setup

from robot.api import logger
import sys

class lib(object):
    ROBOT_LIBRARY_SCOPE = 'TEST SUITE'    # define library scope
    ROBOT_LISTENER_API_VERSION = 2        # select listener API
    def __init__(self):
        self.ROBOT_LIBRARY_LISTENER = self    # tell the framework that it will be a listener library
        self.attributes = None

    def _start_suite(self, name, attributes):
        self.attributes = attributes
    def Get_suite_test_cases(self):
        tests = []
        for test in self.attributes['tests']:
        return tests
globals()[__name__] = lib


1 Like