We have few configurations to read only once while starting the suite and we are doing it as part of start_suite function listener(v3). And we have few test level events being handled using start_test function. When we run two tests in parallel using pabot, It looks like start_suite is being considered before every test similar to start_test. I have tried Pabot keyword ‘Run Setup Only once’ to ensure doing configuration setup only once, but then the configurations are not available for the other test. Is there a way to achieve this using Pabot? Could someone assist me on this?
Hi,
When you run two testcases in parallel they are in different processes similar to if you ran them from two command lines at the same time. If there are only two testcases, then each process is starting a new suite for each testcase.
Run Setup Only Once
will ensure a keyword is only run in the first testcase “process” to hit it, but any variables it configures would of course not be available to other the other processes.
You could split your configuration in two, so that actions that should only ever be done once are protected behind Run Setup Only Once
and the rest of the configuration is done everywhere.
If all the testcases need to know the results of that first set of actions, you can transfer values between processes. See: PabotLib. You will also need to make sure the other processes wait for the first process to finish with what ever it needs to do first, but PabotLib provides several ways to do that.
@burr Thanks for the response
So, If one wants to design their own test automation framework on top of Robot framework and want to use pabot for parallel execution, They might need to consider this behavior of processes and design setup and teardown (suite and test level) functions accordingly beforehand so that they would not need to do rework later to support parallel executions
Is my understanding right here?
Yes - test cases running in separate processes do not implicitly share memory (“variables”), so each needs to be configured (“setup”) separately. However you can explicitly share variables between them, which using Pabotlib makes easier.
@burr Thanks