问题
Example, I have file1.robot
and file2.robot
and each has ${var}
as the variable. Can I pass 2 different values to this same ${var}
in the command line? Something like pabot -v var:one:two file1.robot file2.robot
where -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?
回答1:
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
[Set1]
USERNAME=user1
PASSWORD=password1
[Set2]
USERNAME=user2
PASSWORD=password2
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 ***
Foobar
${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.
Cheers!
回答2:
Another way is to use multiple argument files. One containing the first value for ${var} and the other containing the other.
This will execute the same test suite for both argument files.
pabot --agumentfile1 varone.args --argumentfile2 vartwo.args file.robot
=>
file.robot executed with varone.args
file.robot executed with vartwo.args
来源:https://stackoverflow.com/questions/38675475/robot-framework-with-pabot-is-it-possible-to-pass-two-different-values-to-a-va