This is a parallel launcher for Pybot (see the Robot Framework) that basically allows you to launch several pybot instances at the same time, saving a lot of time on your CI system.
We at Workshare we use in our continuous integration system to parallelize the run of pybot tests so that they take less time to execute. Currently our 1k+ integration test suite for Workshare Connect runs in a couple of hours on our windows machine (of course on Linux it take less then half but hey, we have to validate our stuff with Windows and IE9). Sweet!
The way it works it's really simple: having you installed successfully the Robot Framework) then if you run ppybot.py against any folder containing tests, it will execute such tests in parallel with Pybot using the requested configuration (command line or file), aggregating then the results at the end with Rebot. You can specify the number of retries, the number of parallel bots you want, the timeout for each test... all should work pretty much as you expect it. You can also specify a test that runs before and after the whole parallel running, for global setup and cleanup operation.
When running it also generates xunit compatible output files (named testname.xunit.xml) that can be digested easily from your CI (in our case we use the standard Jenkins reporting mechanism).
When you checkout the project you will also get my super naive example that basically does nothing :) To run it just execute the command:
python ppybot.py .
Two tests will be run in parallel... wowee! Now you can basically try it against any folder containing tests you have, and see the magic happens!
It comes with a configuration file that allows you to fix the most common options and most of it is changeable trough the command line:
- "--timeout" maximum time in seconds spent in executing one test before aborting
- "--reruns", maximum number of reruns executed on failed tests
- "--parallels" maximum number of parallel test running at the same time
- "--logs" folder where logs are generated, must exist!
- "--advertise" the seconds to elapse before advertising the current status
- "--pybot" the command to execute to invoke Pybot i.e. /usr/local/bin/pybot
- "--rebot" the command to execute to invoke Rebot i.e. /usr/local/bin/rebot
- "--failed-only" runs only the failed tests
- "--verbose" verbose mode, more details about wassup
- "--no-fixtures" no fixture code will be run before / after executions
- "--select-from" specify a file containing the names of the test files to execute
- "--pybot-opts" options to pass straight to pybot
- "--rebot-opts" options to pass straight to rebot
The are few thing tough only configurable trough the configuration file:
- TEST_REGEXP the regular expression used to identify tests in the folder, i.e. '.*.txt' (all .txt files)
- BEFORE_RUN a "fixture" test to be executed alone BEFORE the parallel tests starts (tipically used for environment setup)
- AFTER_RUN a "fixture" test to be executed alone AFTER all the parallel tests finished (tipically used for cleanup)
- REPORT_NAME the name of the rebot report
- REPORT_FILENAME the filename of the rebot report
while others can be specified as default in the configuration file:
- MAX_EXECUTION_TIME -> "--timeout"
- FAILED_RERUNS -> "--reruns"
- MAX_PARALLEL_TESTS -> "--parallels"
- ADVERTISE_TIME -> "--advertise"
- PYBOT_CMD -> "--pybot"
- REBOT_CMD -> "--rebot"
Now it's also possible to specifically list the tests you want to execute with the runtime parameter --select-from followed by the name of a plain text file containing for each line a test file name. This is useful when you need to build suites that are generated dynamically and unrelated to the robot tags mechanism. A sample is included here, tests.lst, that will run only the ok tests.
The tool requires the xunitparser library, you can install it via pip
sudo pip install xunitparser
Or follow the instructions at the link :)
Any question please open an issue, we will be happy to answer you! Any change feel free to go for a pull request, and you can of course clone the project but we will appreciate your contributions back :)
Disclaimer: please note that I am not a Python developer, so if the code looks naive it's just because I am not procifient enough. Python is actually a beautiful language, but I do not have time to study it properly at the moment, so I did the best that I could in the (very short) time I had.