An Internet background automation combination test Framework Rf+sikuli+python script
http://www.jianshu.com/p/b3e204c8651a
words 949 Read 323 comments 1 likes 0
First, * * Robotframework 1. * * Tool Description:
Robotframework is used as a platform for organizing test cases and BDD keywords in tests, primarily managed using ride, which is not a tool, but just a framework that is developed using Python while supporting Web testing (Selenium), Java GUI testing, Start the thread, terminal, SSH, etc., support BDD mode, the relevant framework organization structure is as follows:
Paste_image.png
The installation directory structure is as follows:
2.** use case Script organization: * *
For selenium, Robotframework has a third-party library: Selenium2library, supporting the current mainstream page elements, using the organization of keywords, can help us to organize use cases faster, is the community worry-free part of the automation script:
Description
MySuite for each use case
Use cases are split into many processes: Flow.txt
The use case process is also broken down into finer steps: Add_banner_step, Add_msg_data_step, login_step in the case sheet
3. * * use case layering: * *
Organization use case the use case process à use case step, using a hierarchical implementation, and simply call the keyword to organize, so that each page of events and elements encapsulated in their own steps, if the interface elements have any changes, easy to maintain and update, to reduce the impact of changes. (As for the interface element how to locate, please Google related Selenium2 knowledge, also need to focus on is, if not experience, it is best to use Python to write some related code, do not directly on the ride, you can use python+selenium2+ UnitTest frame)
4.** Data tiering: * *
Use Excel to organize your test data, separate the test data, and use your own Python script, as follows:
The introduction of custom scripts, as a library, can be identified in the F5 keyword:
Use keywords, define individual Excel and locate sheet, get sheet field names based on field names, and call data in the form of arguments:
Excel defines the location:
Specific Excel content:
This realizes the data stratification, later, needs to modify the data in the data layer, the direct table modification can be.
5.bdd** Mode:
Use cases also support the organization of BDD patterns,
Second,**python
Because Robotframework is developed using Python, Python is used as the primary scripting language for extensions, and the main purpose is to extend the script that satisfies the test requirements of the related project, for example, the extension script for reading data to Excel as mentioned above:
Possible problems encountered: Chinese recognition problem, at present, due to the limitations of Python itself, we test the software is basically Chinese, so it is possible to encounter Chinese Unicode problem, for this problem is generally resolved:
Create a new sitecustomize.py in Python's Lib\site-packages folder, with the following: #--Coding:utf-8--import sysreload (SYS) Sys.setdefaultencoding (' Utf-8 ')
If you encounter an individual that cannot be completely converted, the following processing:
Third, * * Sikuli
The introduction of Sikuli, in fact, more tangled, because the community worry-free will be more than the use of non-standard control and too many modal windows (modal window problem is OK to solve, can be asynchronous JS and Selenium2 handle method basic solution) is a pending issue. Sikuli is a non-robotframework official tool, so it needs to be called using the remote library:
Organization directory:
To start the remote library:
To import a remote library in ride:
Define the path to the picture that Sikuli intercepts:
To use the Sikuli Remote library method:
Controls that correspond to actions:
Iv. Continuous Integration * *
Using Jenkins for continuous integration, Jenkins itself provides robotframework plug-ins, as long as the relevant parameters are defined and run through the command line without relying on the platform.
An Internet background automation combination test Framework Rf+sikuli+python script