Simple understanding httprunner

    httprunnermanager is htprunner based, Cipian brief introduction

 

table of Contents

1, the installation

2, run a script

 

1, the installation

Step 1: Install

dos window to perform pip install httprunner

 

 Step two: check the version

 

 

2, run a script

The first step: understanding of grammar specification httprunner

His basic syntax specification below:

 

 

  • config: set as the global configuration items throughout the test
  • test: test corresponds to a single
  • name the name of the test
  • This particular test request various information transmitted http request, as follows:
  • request url path (if base_url config definition, then the full path is base_url + url)
  • method request method POST, GET, etc.
  • After validate the completion of the request, verify the contents to be carried out. All the contents are verified by the test considered by otherwise fail.

Step Two: Create a new file and name .yml, such as I have here named test_jpress.yml

I have here is an open-source platform for online login interface completed in accordance with the syntax specification httprunner

- config:
    name: localhost api test
    request:
        base_url: http://localhost:8090
- test:
    name: post request
    request:
        url: /jpress/admin/login
        method: POST
    validate:
        - eq: [status_code,200]

2, run a script

When you are ready yaml file, you can run the script

With a dos window to produce results and generate a report on the results hrun + file to run with

 

 

 

Guess you like

Origin www.cnblogs.com/weizhideweilai/p/12110928.html