We’re creating several test cases using the dynamic library from
variables - In Robot framework, how can I execute multiple of test cases in data driven meithod - Stack Overflow
That means, in robot I have only one test which is creating a test suite with different tests using the keyword “add test case”:
from robot.running.model import TestSuite
class DynamicTestLibrary(object):
ROBOT_LISTENER_API_VERSION = 3
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
ROBOT_LIBRARY_VERSION = 0.1
def __init__(self):
self.ROBOT_LIBRARY_LISTENER = self
self.top_suite = None
def _start_suite(self, suite, result):
self.top_suite = suite
self.top_suite.tests.clear() # remove placeholder test
def add_test_case(self, name, keyword, *args):
tc = self.top_suite.tests.create(name=name)
tc.keywords.create(name=keyword, args=args)
def add_test_matrix(self, data_set, test_scenarios):
for data in data_set:
for test_scenario in test_scenarios:
self.add_test_case(f'{test_scenario} - {data}', test_scenario, data)
globals()[__name__] = DynamicTestLibrary
My robot file looks like:
*** Test Cases ***
Run All Testcases
${JiraIssues} Find Relevant Issues In Jira
FOR ${JiraIssue} IN ${JiraIssues}
Add Test Case ${JiraIssue['key']} Run Jira Test Case
END
*** Keywords ***
Run Jira Test Case
Log To Console Running Test xyz ...
What I need is to parallelize the test cases. Pabot with his standard configuration sees only one test, so the are executed sequently and not in parallel. I’m open to rework the whole file.