自动化测试开发平台搭建指南20150423
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
RobotFramework介绍
命令行参数
• -t --test name * Select test cases to run by name or long name. Name • is case and space insensitive and it can also be a • simple pattern where `*` matches anything and `?` • matches any char. If using `*` and `?` in the console • is problematic see --escape and --argumentfile. • -s --suite name * Select test suites to run by name. When this option • is used with --test, --include or --exclude, only • test cases in matching suites and also matching other • filtering criteria are selected. Name can be a simple • pattern similarly as with --test and it can contain • parent name separated with a dot. For example • `-s X.Y` selects suite `Y` only if its parent is `X`. •
• https://bootstrap.pypa.io/get-pip.py • python get-pip.py
• Python 库列表 • https://pypi.python.org/pypi
Pip常用命令
• pip install PackageName • pip install –upgrade PackageName • pip uninstall PackageName • pip show –files PackageName • pip list --outdated
配置Eclipse
安装Pydev
配置Pydev
配置代码缩进
pip install robotframework
RobotFramework安装
• pip install robotframework • 不用下载,直接在scripts下执行上面的指令就行了。 • Wxpython(目前仅支持2.8.12.1) • http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/ • 安装Ride工具 • pip install robotframework-ride • 不用下载,直接在scripts下执行上面的指令就行了。
安装Python
• https://www.python.org/ • 下载Python 2.7 的最新版本并安装
• • (python的安装路径不能有带空格的目录) 检查环境变量,PATH路径中加入python安装路径和$PYTHONPATH\ Scripts
• • • • • •
安装python扩展包安装工具setuptools https://pypi.python.org/pypi/setuptools/ Python setup.py install Python setup.py -h 安装python扩展包管理工具pip https://pip.pypa.io/en/latest/installing.html
来自百度文库
• -V --variablefile path * File to read variables from (e.g. `path/vars.py`). • Example file: • | import random • | __all__ = [`scalar`, `LIST__var`, `integer`] • | scalar = `Hello world!` • | LIST__var = [`Hello`, `list`, `world`] • | integer = random.randint(1,10) • => • ${scalar} = `Hello world!` • @{var} = [`Hello`,`list`,`world`] • ${integer} = <random integer from 1 to 10>
自动化开发环境搭建
下载最新的Eclipse版本
• 下载并安装最新的java JDK版本(Java Platform (JDK) 8u20) • http://www.oracle.com/technetwork/java/javase/downloads/index.h tml
• 根据自己的需求下载对应的Eclipse版本,可选择javaEE的或C的或 者Standard都可以 • http://www.eclipse.org/downloads/
其他
• MySQL
• pip install MySQLdb • http://dev.mysql.com/downloads/connector/python/
• Paramiko
• pip install paramiko • http://www.voidspace.org.uk/downloads/pycrypto26/ • http://www.lfd.uci.edu/~gohlke/pythonlibs/
其他
• VS2008或者VS2010
• 如果是64位操作系统安装时必须选择64位编译的支持
• Oracle Instant Client and cx_oracle
• 下载oracle instant client的SDK文件 • pip install cx_oracle • 64位的python需要64位oracle client的dll文件。拷贝dll文件至python sitepackages目录下
• 用户定义关键词
创建测试库
• Library Documentation Introduction • BuiltIn Contains generic often needed keywords. Imported automatically and thus always available. • Collections Contains keywords for handling lists and dictionaries. • DateTime Supports creating and verifying date and time values as well as calculations between them. • Dialogs Supports pausing the test execution and getting input from users. • OperatingSystem Enables performing various operating system related tasks. • Process Supports executing processes in the system. • Remote Special library acting as a proxy between other libraries running different machines or processes. See Remote library wiki page for more details. • Screenshot Provides keywords to capture and store screenshots of the desktop. • String Library for manipulating strings and verifying their contents. • Telnet Supports connecting to Telnet servers and executing commands on the opened connections. • XML Library for verifying and modifying XML documents.
• -v --variable name:value * Set variables in the test data. Only scalar • variables are supported and name is given without • `${}`. See --escape for how to use special characters • and --variablefile for a more powerful variable • setting mechanism that allows also list variables. • Examples: • --variable str:Hello => ${str} = `Hello` • -v str:Hi_World -E space:_ => ${str} = `Hi World` • -v x: -v y:42 => ${x} = ``, ${y} = `42`
• -d --outputdir dir • -o --output file • -l --log file • -r --report file
• -L --loglevel level Threshold level for logging. Available levels: TRACE, • DEBUG, INFO (default), WARN, NONE (no logging). Use • syntax `LOGLEVEL:DEFAULT` to define the default • visible log level in log files. • Examples: --loglevel DEBUG • --loglevel DEBUG:INFO
关键字
• 内置关键词
• http://robotframework.org/robotframework/latest/libraries/BuiltIn.html • Should Be Empty,Should Be Equal,Should Be True,Should Contain, Should Contain X Times,Should End With,Should Match,Should Match Regexp,Sleep,Wait Until Keyword Succeeds,Documentation
• -A --argumentfile path * Text file to read more arguments from. Use special • path `STDIN` to read contents from the standard input • stream. File can have both options and data sources • one per line. Contents do not need to be escaped but • spaces in the beginning and end of lines are removed. • Empty lines and lines starting with a hash character • (#) are ignored. • Example file: • | --include regression • | --name Regression Tests • | # This is a comment line • | my_tests.html • | path/to/test/directory/ • Examples: • --argumentfile argfile.txt --argumentfile STDIN
• -i --include tag * Select test cases to run by tag. Similarly as name • with --test, tag is case and space insensitive and it • is possible to use patterns with `*` and `?` as • wildcards. Tags and patterns can also be combined • together with `AND`, `OR`, and `NOT` operators. • Examples: --include foo --include bar* • --include fooANDbar* • -e --exclude tag * Select test cases not to run by tag. These tests are • not run even if included with --include. Tags are • matched using the rules explained with --include. • -R --rerunfailed output Select failed tests from an earlier output file to be • re-executed. Equivalent to selecting same tests • individually using --test option.