current position:Home>Construction and development of automatic test platform based on HTTP runner
Construction and development of automatic test platform based on HTTP runner
2022-04-29 09:53:55【Incoming Thor】
Objective record
1 Preface
1.1 Purpose of the document
1.2 Terminology
2 Implementation principle of interface automation test
2.1 Principles of implementation
2.2 Advantages and disadvantages of implementing interface automation test
3 Implementation scope and objectives
3.1 Scope of implementation
3.2 Implementation objectives
3.3 Overall implementation strategy
4 Implementation content of the technical scheme
4.1 httprunner Features and advantages :
4.2 httprunner How it works :
4.2.1 First step : Environment building
4.2.2 The second step : Write a script
4.2.3 The third step : Perform the test
4.3 Jenkins Installation, deployment and configuration of
4.3.1 First step : Code upload svn
4.3.2 The second step :jenkins Deploy
4.3.2.1 jenkins New project
4.3.2.2 jenkins Description of the project
4.3.2.3 jenkins Code configuration for
4.3.2.4 Select Delete workspace before build
4.3.2.5 perform windows Batch command
4.3.2.6 Test report css Rendering
4.3.2.7 Configuration of test report
4.3.3 The third step : View test report
4.3.3.1 Open the project directory , Click on HTML_Report
4.3.3.2 Select... Under the corresponding timestamp .html file
4.3.3.3.1 Request
4.3.3.3.2 Validators
4.3.3.3.3 Staristics
5 Implement management recommendations
5.1 Implementation strategy suggestions
5.2 Staffing
5.3 Implementation plan
Preface
Purpose of the document
The interface automation test scheme is to use the automation framework for the interface test of Lama system , The technology and implementation scheme written to achieve the goal of automatic interface testing .
The main purpose of the document is to provide the technical scheme of interface automatic test 、 Implementation content 、 Implementation steps , As well as the key technical implementation means .
Terminology
- Httprunner: It is an interface automation framework developed by Dajiang company , be based on http agreement
- Hrun:httprunner Start command for executing interface test under the framework
- Validate: Assertion , To verify whether the returned data is consistent with the passed in parameters
Implementation principle of interface automation test
Principles of implementation
In the process of interface automation testing, it is impossible for tools to complete all the work , Tools are still an aid in the testing process . For tools, it is mainly to solve the repetitive tasks in the testing process . In addition, implement automated testing , There are also higher requirements for the tested system , The implementation principles of interface automation test are summarized as follows :
- Use automated tools to test , The development of the tested system is required to be relatively stable , Less functional changes ;
- Before writing automated test scripts , The interface of the tested system is relatively stable ;
- Interface test automation requires that the test data in the test data environment is relatively independent , Meet the requirements of complete control data test ;
- The version of the tested system is required to run stably , Fewer test aborts occur ;
- Perfect 、 Reusable data parameters , Script library is a long-term accumulation process .
Advantages and disadvantages of implementing interface automation test
Although there are many limitations between automatic test and manual test of interface , But it also has its advantages , With the development of automatic testing technology and tools , For the stable function of the product under test , Automated testing plays a more and more important role . Using interface testing can speed up the whole testing process , After the release of the product version , Test scripts can be reused for testing , say concretely :
The advantages of automated testing :
- Improve test efficiency , Reduce the cost of testing ;
- Manual labor with strong repeatability can be realized independently by automation ;
- Rapid regression testing , Improve the speed and quality of new version release ;
- Avoid mistakes easily made by manual testing , Such as : Error testing , Leak test , More tests, etc ;
- It's easy to implement concurrency testing ;
- Test reusability , Reusing scripts and data is easy .
The disadvantages of automated testing :
- Standardized test management , Test requirements , The test case ;
- Can't creatively find the defects that the test script has no design ;
- High quality test cases ;
- High quality automation test engineer ;
- The requirements for the test environment are relatively strict ;
- Changes in test requirements may cause a large number of test cases , Automatic test script modification 、 maintain .
Implementation scope and objectives
Scope of implementation
- Tool range : At present, we are considering using svn As a remote code warehouse ,httprunner As the main framework ,jenkins As a continuous integration tool
- System scope : Locate the system in the basic test environment of the test center ;
- Scope of the test phase : New functional testing 、 regression testing 、 And functional regression test after going online
Implementation objectives
- The interface automation test system should be able to complete the integration test 、 And the regression test of the function after the launch ;
- The interface automation test scheme can test most of the current application systems ;
- Realize automatic scripting 、 Automate script execution 、 Automated defect reporting and management .
Overall implementation strategy
- First, select the items and functions suitable for automatic testing from the current system ;
- Secondly, determine the stage of interface automation test ;
- The interface functions are combined to form a complete system test
Implementation content of the technical scheme
Httprunner Features and advantages
- Inherit Requests All characteristics , Make it easy HTTP(S) All kinds of testing requirements
- use YAML/JSON Describe the test scenario in the form of , Guarantee the uniformity and maintainability of test case description
- With the aid of auxiliary functions (debugtalk.py), It is easy to implement complex dynamic computing logic in test scripts
- Support perfect test case layering mechanism , Fully realize the reuse of test cases
- Support perfect before and after the test hook Mechanism
- The response results support rich verification mechanisms
- be based on HAR Realize interface recording and use case generation (har2case)
- combination Locust frame , No extra work is needed to implement distributed performance testing
- The way of execution is CLI call , But with Jenkins And continuous integration tools
- The statistical report of test results is concise and clear , With detailed statistics and log records
- Extremely scalable , Easy to implement secondary development and Web platform
Httprunner How it works
- Clear test purpose (achieve a particular software testing objective)
- Clear input (inputs)
- Clear operating environment (execution conditions)
- Clear description of test steps (testing procedure)
- Clear expected results (expected results)
First step : Environment building
- Install... On the server python Environmental Science
- perform pip install httprunner
- Run the following command , If the version number is displayed normally , shows HttpRunner Installation successful
$ hrun -V
2.0.2
$ har2case -V
0.2.0
The second step : Write a script
Name: api Description of
Base_url: Basic website
Request:http Form of request
Method: Request mode
Url: Name of spliced interface
Json: The ginseng
Validate: Assertion
The third step : Perform the test
Carry out orders : hrun + api(path)
Jenkins Installation, deployment and configuration of
First step : Code upload svn
The second step :jenkins Deploy
Jenkins New project
Jenkins Description of the project
Jenkins Code configuration for
Select Delete workspace before build
perform windows Batch command
Test report css Rendering
Configuration of test report
The third step : View test report
Open the project directory , Click on HTML_Report
Select... Under the corresponding timestamp .html file
The content of the test report
Request
Validators
Staristics
Implement management recommendations
Implementation strategy suggestions
The strategy has the following suggestions :
- Data coverage from the bottom up , Solve the dependency of test data , Control the correctness of the whole interface test data
- Review coverage of test cases
- Prepare the corresponding api file
Staffing
In the process of automatic test implementation , The following staffing is required :
- Test Manager : Be responsible for the coverage review of test cases
- Developer : Preparation and communication of interface documents
- Script writer : Need to have http The basis of the agreement , as well as python The basis of language
Implementation plan
Stage | Time | Stage key tasks / Milestone goals |
Plan preparation stage | Determine the objectives and scope of the project ; | |
Environment construction and preparation | Build an automated test environment ; | |
Test requirements analysis stage | Analyze the requirements of the tested system ; | |
Test script development | Complete the script framework ; | |
The test execution | The test execution 、 Report a problem . | |
Test analysis summary | test result ; |
copyright notice
author[Incoming Thor],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204290811054269.html
The sidebar is recommended
guess what you like
Ajax learning notes
Relearn react (1) - recognize the life cycle
Small problems encountered by react usereducer and Solutions
CSS realizes the square of adaptive screen width
Nginx + ModSecurity setup
Bootstrap web job
bootstrap
Swoft 2. X Foundation (HTTP, database, redis)
Docker actual combat case 2: nginx load balancing
Vue basic syntax
Random recommended
- Go basic syntax 3 (socket, httpserver)
- Nginx configures HTTPS and calls http
- Nginx parsing vulnerability
- How can the backend package Vue projects quickly
- Netty configures WSS protocol access through nginx (Practical)
- Total permutation problem_ Not containing the same element and containing the same element_ Leetcode46_ Leetcode47_ Backtracking solution + java code
- How to upload and download files using Axios in nodejs
- Vue excel file upload
- CondaHTTPError: HTTP 000 CONNECTION FAILED for url < https://conda.anaconda.org/fastai/noarch/repodat
- Multi function environmental monitoring pole scheme based on wireless gateway
- JPS in Hadoop, but http://hadoop01:50070/ How to solve the problem if there is no interface? 500ha70 cluster can't be accessed?
- Tool class for obtaining specific information in HTTP request
- UAV project tracking record 65 - wireless transceiver module circuit
- UAV project tracking record 76 - wireless transceiver module circuit
- Basic concept of angular velocity
- Front end login password encryption and decryption
- Vue parent-child component mutual transmission and intermodulation
- Vue nested loop array, select one of them and add the selected style
- The Vue seamless scroll list scrolls automatically
- Vue line graph moves dynamically to the right
- Install and configure nginx in Linux Environment
- Vue dynamically binds attributes and dynamically obtains attribute values
- Summary method of Vue value in key pair mapping
- Vue simply realizes the addition, deletion and modification of each tab page without route jump
- Vue time control common processing
- Vue validation array
- Simple and easy to let you know what AJAX is, even if you are a little white, a rookie can understand it!
- Receive the JSON string from the front end, and summarize the methods of parsing and value taking at the back end
- Solution: httpmessagenotreadableexception: JSON parse error: invalid UTF-8
- Vuetify: install vuetify from scratch
- Install CSS from tailwind
- Ubuntu 16 wireless network card model query and driver installation, Lenovo g400 bcm43142 network card WiFi
- Some color knowledge to understand at the front end
- Functional programming of front-end development
- A front-end interview question -- implementing an encapsulated Ajax device (promise version)
- Dynamic components of angular
- Front end written test pit -- JS implicit conversion
- Shallow understanding of HTTP
- React style modification background invalid
- Finding the k-th small element of ordered matrix (dichotomy idea)