使用pabot并发执行robotframework测试
2016-05-05 11:58
1001 查看
原文地址:https://github.com/mkorpela/pabot
Pabot
A parallel executor for Robot Framework tests. With Pabot you can split one execution into multiple and save test execution time.My goal in creating this tool is to help you guys with big test sets. I've worked with a number of teams around the world that were doing test execution time optimisation before I created this tool. I saw similarities in how Robot Framework testing systems have been built and came up with a quite good solution for the basic parallelisation problem. I hope this tool brings you joy and speeds up your test execution! If you are interested in professional support, please contact me through email firstname.lastname(at)gmail.com! - Mikko Korpela ( those are my firstname and lastname :D )Installation:
From PyPi:pip install -U robotframework-pabotOR clone this repository and run:
setup.py install
Things you should know
Pabot will split test execution from suite files and not from individual test level.In general case you can't count on tests that haven't desinged to be executed parallely to work out of the box when executing parallely. For example if the tests manipulate or use the same data, you might get yourself in trouble (one test suite logs in to the system while another logs the same session out etc.). PabotLib can help you solve these problems of concurrency. Also see TRICKS for helpful tips.
Command-line options
Supports all Robot Framework command line options and also following options (these must be before normal RF options):--verbosemore output--command [ACTUAL COMMANDS TO START ROBOT EXECUTOR] --end-command
RF script for situations where pybot is not used directly--processes [NUMBER OF PROCESSES]
How many parallel executors to use (default max of 2 and cpu count)--pabotlib
Start PabotLib remote server. This enables locking and resource distribution between parallel test executions.--pabotlibhost [HOSTNAME] Host name of the PabotLib remote server (default is 127.0.0.1) If used with --pabotlib option, will change the host listen address of the created remote server (see https://github.com/robotframework/PythonRemoteServer) If used without the --pabotlib option, will connect to already running instance of the PabotLib remote server in the given host. The remote server can be started with: python PabotLib.py python PabotLib.py resource.txt 192.168.1.123 8271 This enables sharing a resource with multiple Robot Framework instances--pabotlibport [PORT] Port number of the PabotLib remote server (default is 8270) See --pabotlibhost for more information--resourcefile [FILEPATH]
Indicator for a file that can contain shared variables for distributing resources. This needs to be used together with pabotlib option. Resource file syntax is same as Windows ini files. Where a section is a shared set of variables.Example usages:
pabot test_directory pabot --exclude FOO directory_to_tests pabot --command java -jar robotframework.jar --end-command --include SMOKE tests pabot --processes 10 tests pabot --pabotlibhost 192.168.1.123 --pabotlibport 8271 --processes 10 tests pabot --pabotlib --pabotlibhost 192.168.1.111 --pabotlibport 8272 --processes 10 tests
PabotLib
pabot.PabotLib provides keywords that will help communication and data sharing between the executor processes. These can be helpful when you must ensure that only one of the processes uses some piece of data or operates on some part of the system under test at a time.Docs are located at http://htmlpreview.github.io/?https://github.com/mkorpela/pabot/blob/master/PabotLib.htmlPabotLib example:
test.robot*** Settings *** Library pabot.PabotLib *** Test Case *** Testing PabotLib Acquire Lock MyLock Log This part is critical section Release Lock MyLock ${valuesetname}= Acquire Value Set ${host}= Get Value From Set host ${username}= Get Value From Set username ${password}= Get Value From Set password Log Do something with the values (for example access host with username and password) Release Value Set Log After value set release others can obtain the variable valuesvalueset.dat
[Server1] HOST=123.123.123.123 USERNAME=user1 PASSWORD=password1 [Server2] HOST=121.121.121.121 USERNAME=user2 PASSWORD=password2pabot call
pabot --pabotlib --resourcefile valueset.dat test.robot
相关文章推荐
- How to excute javascript on Robotframework
- 怎么样新建RobotFramework 的测试用例
- 怎么样导入RobotFramework 的库文件
- 玩转RobotFramework下的Web自动化测试(二)——关于上篇文章的一些思考
- 玩转RobotFramework下的Web自动化测试(一)——获取页面table中的行数
- RobotFramework自动化测试框架系统关键字之断言
- Robotframework平台搭建
- robotframework环境配制
- 封装Selenium2Library
- 【RobotFramework-RequestsLibrary】post方法data值无法传入的问题
- Robot Framework 入门教程总结
- RobotFramework+seleniumlibrary Web自动化测试 (二)
- RobotFramework+seleniumlibrary Web自动化测试 (三)
- RobotFramework+seleniumlibrary Web自动化测试 (四)
- jenkins中文编码
- RobotFrameWork(一)robotfamework(python版)及Ride在windows安装
- RobotFrameWork(一)robotframework(python版)及Ride在ubuntu下安装
- no python installation found in the registry
- RobotFrameWork(十)Remote远程库使用
- RobotFrameWork(五)控制流之if语句——Run Keyword If