'Pabot: How to use different dataset for each thread

I'm trying to Use Pabot to parallelize Robot Tests. Let me explain the issue.

Assume I have TestA and TestB tests. And DataA , DataB dataset.

There is 2 way/ goal to use the Pabot.

1. Run the same test against the different dataset (e.g different mobile devices) / I know this should be done with --argumentfileX options flag. So following will be the test runs.

TestA with DataA
TestA with DataB
TestB with DataA
TestB with DataB

It's obvious that this is useful when you want to run your test against various Env/Data.

2. Divide and split the run time. The goal is to reduce the runtime as much as possible, following is the desired

TestA with DataA
TestB with DataB

This one (# 2) is my goal. I'm trying this: robot framework with pabot : is it possible to pass two different values to a variable in two tests

I mean this command:

pabot --pabotlib --resourcefile Log/pabot_dataset.dat --include test-tag --processes 4 SUITE

But the problem is Importing pabot.pabotlib and Acquire Value Set command should exist in every single robot test-cases which has much cost for me to change the robot files as there are thousands tests here.

So what is the solution?



Solution 1:[1]

You will have to at least change test suite, you can pass "Acquire Value Set" into Test Setup once so you don't have to change each test case.

*** Settings ***
Library    pabot.PabotLib
Test Setup    Assign Value Set  

*** Keywords ***
Assign Value Set
    ${valuesetname}=    Acquire Value Set
    Set Test Variable    ${valuesetname}

If you do not want to change test suite files, you can use initialization files. Create __init__.robot file in folder where test suites are located and add these lines

*** Settings ***
Library    pabot.PabotLib
Test Setup    Acquire Value Set

But it has some limitations such as "Variables and keywords created or imported in initialization files are not available in the lower level test suites.".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1