I have automated test which takes input from the user and runs the test. Any idea on if we can give the argument from jenkins for the robot testcase and run the test?
ex: scenario: Test if a lighting device works well or not. steps:
In this case, I need to take light device username and password as input from user. Is it possible to get it from jenkins (build with parameters) and run the robot test case?
You can use variables. For example, a user keyword connecting and logging in might be like:
Connect To Device
[Arguments] ${HOST}
Open Connection ${HOST}
Login ${USERNAME} ${PASSWORD}
Now, provided your Jenkins parameters are username
and password
, you can use the execute shell task like this:
pybot --variable USERNAME:[username] --variable PASSWORD:[password] <path/to/tests>
This sets global variables ${USERNAME} and ${PASSWORD} for the test execution.
More info in the user guide.