How to use data-driven test basis in robotframework

I. EDITORIAL

robotframework keyword-driven testing framework is very easy to use, but also in some places inconvenient to use in practical work, such as when we design parameter verification test case, often just want to change the type of calibration parameters had to do a lot of copy and paste operations , eventually leading to a large number of redundant code in a test case, and if the change occurs once in subsequent use, the test case will be inconvenient to maintain.

For this case, the package attempts to think a lightweight framework robotframework function based on test data for automated driving system interface portion of the test scenarios.

II. Description of the components required

1.python2.7

2.robotframework

3. dependent libraries

Library RequestsLibrary

Library Collections

Library OperatingSystem

Library Process

Library String

Library XML

Library HttpLibrary.HTTP

Library DiffLibraryLibrary 

../ CustomKeyword.py (custom dependency libraries), etc.

4.excel && txt

 

III. Test Case Project Description

 

test-xxx-xxx // test case project name

- → data // test data folder

        ----> api-test.txt // testing framework for data acquisition

        ----> api-test.xls // convenient tester conducted case design editor

- → testcase // testing framework folder

        ----> xxxxxx-api.txt // Interface Test Framework

        - → start.sh // j startup script

CustomKeywork.py // custom keyword library

README.md // know

 

1.data folder to store test data

 

 

2.testcase file storage folder test case instance, reported after the test is completed, the startup script (txt document which is the test case for instance robotframework call, log.html, report.html, output.xml test report, start.sh is startup script)

 

3. Custom test libraries (with some test functions)

 

test data is stored in specific data interface can be used to excel conf-api-test.xls configuration can also be opened directly edit the corresponding txt (Note: the final tool when the test is read txt file, using excel after the configuration needs to be replaced with the corresponding data in the table data txt)

 

View excel

 

Content does not require verification of use? * Regular match off

 

txt View

 

Wherein data is divided into four

   The first column: Use Case Name

   Second column: cases with execution switch (open configuration by executing this case yes, no configuration of this case is not performed)

   Third column: the input data (called data interface requests)

   The fourth column: the expected output  

IV. Architecture workflow

 

V. Code Description

1. graphical charts illustrate key

Call library operations and global variable and constant

 

2. Custom Keyword Description

3. Third-party Keyword Description

Variable assignment keyword

 

String concatenation keyword

 

Variable calculation Keyword

 

if conditional keywords

continue keywords

 

Assertion failed to continue to perform keyword

Regular keyword matching assertion

4. GET request method distinction

Required before requesting call unicode need to convert input data into a dictionary type of type

 

VI. Comparison

before use

After use

testing report

 

 

VII. Follow-up

1. Add test output recording function;

2. Standardized test data format that can be compatible with multi-tool use;

Etc., etc

Guess you like

Origin www.cnblogs.com/flowertester/p/11355636.html