Introduction to HttpRunner of HttpRunner Capture Tool

Introduction to HttpRunner:

  HttpRunner is a general-purpose testing framework for the HTTP(S) protocol. It only needs to write and maintain a YAML/JSON script to realize various testing requirements such as automated testing, performance testing, online monitoring, and continuous integration.

  The author, Li Long, was a test development engineer at DJI before. The project originated from the internal test requirements of DJI, and then turned into an open source project.

HttpRunner operating environment:

1. HttpRunner is a test framework developed based on Python, which can run on macOS, Linux, and Windows system platforms.

2. Python version: HttpRunner supports all versions of Python 3.4 and above, and uses Travis-CI for continuous integration testing. The versions covered by the test include 2.7/3.4/3.5/3.6/3.7. Although HttpRunner has temporarily retained compatibility support for Python 2.7, it is strongly recommended to use Python 3.4 and above.

3. Operating system: macOS/Linux is recommended.

HttpRunner design concept:

  • Fully reuse excellent open source projects, do not pursue reinventing wheels, but assemble powerful wheels into chariots
  • Follow the principle of convention over configuration
  • Incorporate automated testing best engineering practices into framework functions
  • The pursuit of input-output ratio, a single input can achieve a variety of testing requirements

HttpRunner core features:

  Inherit all the features of Requests, and easily realize various testing requirements of HTTP(S);

  Use YAML/JSON to describe test scenarios to ensure the uniformity and maintainability of test case descriptions

  With the help of auxiliary functions (debugtalk.py), it is easy to implement complex dynamic calculation logic in test scripts

  Support a complete test case layering mechanism to fully realize the reuse of test cases

  Support perfect hook mechanism before and after testing

  The response result supports a rich verification mechanism

  Interface recording and use case generation based on HAR (har2case)

  Combined with the Locust framework, distributed performance testing can be achieved without additional work

  The execution method adopts CLI call, which can be perfectly combined with continuous integration tools such as Jenkins

  The statistical report of test results is concise and clear, with detailed statistical information and log records

  Strong scalability, easy to achieve secondary development and Web platform

In the HttpRunner automated test project, there are mainly the following types of files:

YAML/JSON (required): test case file, one file corresponds to one test case

debugtalk.py (optional): script function, storing logical operation functions in the project

When this file exists, it will be used as the positioning mark of the project root directory, and the directory where it is located is regarded as the root directory of the project project (the current working directory CWD)

When this file does not exist, the path where the tests are run will be taken as the current working directory CWD

The relative path (such as .csv) in the test case file must be based on the current working directory CWD

After running the test, the test report folder (reports) will be generated in the current working directory CWD

.env (optional): stores project environment variables

.csv (optional): project data file for data-driven

reports (automatically generated): automatically generated after running, no need to create

Practical case

Optical theory is useless, you have to learn to follow along, and you have to do it yourself, so that you can apply what you have learned to practice. At this time, you can learn from some actual combat cases.

If it is helpful to you, please like and collect it to give the author an encouragement. It is also convenient for you to quickly find it next time.

If you don’t understand, please consult the small card below. The blogger also hopes to learn and progress with like-minded testers

At the right age, choose the right position, and try to give full play to your own advantages.

My road of automated test development is inseparable from the plan of each stage along the way, because I like planning and summarizing,

Test and develop video tutorials, study notes and receive portals! ! !

Guess you like

Origin blog.csdn.net/Liuyanan990830/article/details/131400617