In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use Httprunner for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Brief introduction of main features
HttpRunner is a general testing framework for HTTP (S) protocol. It only needs to write and maintain a YAML/JSON script to achieve automated testing, performance testing, online monitoring, continuous integration and other testing requirements.
Inherit all the powerful features of requests and enjoy the fun of humanized handling of HTTP (S). Test cases are defined in YAML or JSON format, and pytest runs in a concise and elegant manner. Record and generate test case HAR with support. Support the / variables mechanism to create an extremely complex test scenario extract. Validatehooks uses the debugtalk.py plug-in, and any function can be used in any part of the test case. With jmespath, extracting and validating json responses has never been easier. With pytest, hundreds of plug-ins are readily available. With allure, test reports can be very beautiful and powerful. By reusing locust, you can run performance tests without extra work. Support for CLI commands, and CI/CD
Explain the difference between Python3.6+Httprunner2.x and 3.x
Execution use case framework: 3.x is pytest;2.x is unitest
Use case format: 3.x support YAML/JSON/pytest;2.x support YAML/JSON
Installation
Need python3.6+ environment: you can refer to python environment to build.
Use pip
Installation
Pip3 install httprunner
It can also be installed using github source code
Pip3 install git+ https://github.com/httprunner/httprunner.git@master
If you previously installed HttpRunner, you can use the-U option to upgrade to the latest version
Pip3 install-U httprunner# or pip3 install-U git+ https://github.com/httprunner/httprunner.git@master
View version
Pip show httprunner
Related command
View help
Httprunner-h
Parameter name function-V-- version View version number-h,-- help View help run is used to run YAML/JSON/Pytest test cases startproject to create a new project using template structure har2caseHAR (HTTP Archive) to YAML/JSONmakeYAML/JSON test cases to pytest cases
After installing HttpRunner, the following five commands are written to the system environment variable configuration.
Httprunner: the main command for all functions.
Hrun: an alias for the instruction httprunner run, used to run YAML/JSON/Pytest test cases.
Hmake: an alias for the instruction httprunner make to transform the YAML/JSON use case into the pytest use case.
Har2case: directs an alias for httprunner har2case to convert HAR files into YAML/JSON use cases.
Locust: run performance tests with locust.
Basic use to create a project
Httprunner startproject project name
Httprunner startproject dahai_demo
Use case from make to pytest
Make is to convert a YAML/JSON test case into a pytest use case, and you need to specify the yaml file path or folder path.
Httprunner make testcase # is equivalent to hmake testcase
Run run use case
The run command actually has two actions, one is to convert the YAML/JSON test case into a pytest use case, which is the same as the function of the previous step make, and the second action is to execute the test case with pytest
Httprunner run testcases# is equivalent to hrun testcase.
This is the end of the article on "how to use Httprunner". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.