Freddy Freddy - 5 months ago 63
Python Question

robot framework with pabot : is it possible to pass two different values to a variable in two tests

Example, I have

and each has
as the variable. Can I pass 2 different values to this same
in the command line? Something like
pabot -v var:one:two file1.robot file2.robot
-v var:one:two
would follow the order of the robot files; not by name but by how they were introduced in the command line?


This solution is not 100% what you've asked for, but maybe you can make it work.

In pabot readme file is mentioned something about shared set of variables and acquiring set for each running process. The documentation was bit unclear to me, but if you try following example, you'll see for yourself. It's basically pool of variables and each process can get set of variables from it and when it's done with it, it can return this set back to the pool.

Create your value set valueset.dat



create suite1.robot and suite2.robot. I've created 2 suites that are exactly the same. I just wanted to try to run 2 suites in parallel.

*** Settings ***
Library    pabot.PabotLib

*** Test Cases ***
    ${valuesetname}=    Acquire Value Set
    Log    ${valuesetname}
    ${username}=     Get Value From Set   username
    Log    ${username}
    # Release Value Set

And then run command pabot --pabotlib --resourcefile valueset.dat tests. If you check html report, you'll see that one suite used set1 and other used set2.

Hope this helps.