The environment installed, I believe that many children have been eager to run up, but in the face of a strange framework and do not know how to start. Never mind, we can use scaffolding to quickly generate an Httprunner project.

Quick project generation

We might as well enter Httprunner startProject -h to see the command description.

httprunner startproject -h
Copy the code



As you can see, all you need to do is add the project name to the command, so create a project called Httprunner_demo.

httprunner startproject httprunner_demo
Copy the code



After the project is generated, it is also very simple.

Httprunner will give a warning if the project name you entered already exists.



Httprunner startproject is similar to django-admin.py startproject project_name, as those of you who have seen Django will know. The idea of Httprunner comes from Django. This is just one example of httprunner as an excellent source technology for resource integration and reuse. There are many more to come.

Ii. Project structure sorting

I put the generated items into Sublime for easy viewing. The generated directory structure can be seen below, so what does it all mean?

  • Debugtalk. py is placed in the project root (borrowed from the conftest file design of PyTest)
  • Env is placed in the project root directory and can be used to store environment variables
  • Reports folder: Stores HTML test reports
  • Testcases stores testcases
  • Har can be used to store recorded exported files. The specific usage of HAR files will be explained in detail in the future, and will not be expanded in this chapter. We can open the generated testcases folder under testcases, which provides a working demo content, and run it first.

Run the use case:

hrun httprunner_demo
Copy the code

Httprunner displays debugging information during the operation



Finally, the run ends, and both use cases run pass.



The preparatory work is over, and then you can enter the detailed study.