当前位置:网站首页>Pytest+allure generate test report
Pytest+allure generate test report
2022-07-29 09:33:00 【Test kid】
Preface
Allure Framework It's a flexible, lightweight, multi language test reporting tool , Not only can the content of the network be displayed in a very concise form , It also allows everyone involved in the development process to extract the most useful information from daily execution .
One 、 install
Use pip install pytest and allure-pytest, add --index-url Address , The download will be faster
pip install pytest==4.5.0 --index-url https://pypi.douban.com/simple
pip install allure-pytest==2.8.6 --index-url https://pypi.douban.com/simple
allure Is a command line tool , Need to go github Download the latest version Releases · allure-framework/allure2 · GitHub
Once the download is complete , Unzip it to your local computer
hold bin Directory added to environment variable Path Next
3、 ... and 、 Instructions
@allure.feature # Used to define the function being tested , The demand point of the tested product
@allure.story # The user scenario used to define the tested function , That is, subfunction point
with allure.step # Used to put a test case , Output... In the report in several steps
allure.attach # Used to enter some additional information into the test report , Usually some test data information
@pytest.allure.step # It is used to output some general functions to the report as test steps , Where this function is called, the steps are output to the report
Four 、 Example
import allure
import pytest
@allure.step(" step 1: spot xxx")
def step_1():
print("111")
@allure.step(" step 2: spot xxx")
def step_2():
print("222")
@allure.feature(" Edit page ")
class TestEditPage():
''' Edit page '''
@allure.story(" This is a xxx The use case ")
def test_1(self, login):
''' Use case description : Log on first , To perform xxx'''
step_1()
step_2()
print("xxx")
@allure.story(" open a page ")
def test_2(self, login):
''' Use case description : Log on first , To perform yyy'''
print("yyy")
cd To test_allure_demo.py The directory file where it is located , Command line execution
pytest --alluredir ./report/allure_raw
After execution , Generate... In the current directory report Catalog ,report Create one in the directory allure_raw The catalog of , Here are the test reports JSON Format original file , It can't be opened html The report of
start-up allure Reporting Services , Input the generated IP Address and port can be accessed
allure serve report/allure_raw |
5|0Jenkins + allure Generate a report
Installing a plug-in
Select restart after installation
Open after installation jenkins home page - System management - Global tool configuration -Allure Commandline, install allure Command line tools
Build run command
cd C:\Users\Administrator\Desktop\learn\py23\chongshi\pycs
pytest C:\Users\Administrator\Desktop\learn\py23\chongshi\pycs\test_allure_demo.py --alluredir ${WORKSPACE}/allure_raw/
Finally, in my QQ The technical exchange group sorted out my 10 Some technical data sorted out by software testing career in recent years , Include : e-book , Resume module , Various work templates , Interview treasure , Self study projects, etc . If you encounter problems in your study or work , There will also be great gods in the group to help solve , Group number 798478386 ( remarks CSDN555 )
Full set of software test automation test teaching video
300G Download tutorial materials 【 Video tutorial +PPT+ Project source code 】
A complete set of software testing automation testing factory has been
边栏推荐
- 机器学习之分类模型评估指标及sklearn代码实现
- What kind of framework is friendly to developers?
- 40余岁的边缘老技术,是未来乏力还是掘地而起?
- 原型链继承和构造函数继承的 “毛病”
- 不用Swagger,那我用啥?
- 数据库表结构生成excel工具
- Flowable UI制作流程图
- Use cpolar to publish raspberry pie web pages (improvement of cpolar tunnel)
- QMainWindow 详解
- Use cpolar to publish raspberry pie web pages (improvement of cpolar function)
猜你喜欢
(Video + graphics) introduction to machine learning series - Chapter 1 Introduction
Flowable UI制作流程图
I don't know how lucky the boy who randomly typed logs is. There must be a lot of overtime
VS2015采用loadlibrary方式调用dll库
Network security (6)
Four types of technical solutions shared by distributed sessions, and their advantages and disadvantages
How to change MySQL into Chinese
Senparc.Weixin.Sample.MP源码剖析
乱打日志的男孩运气怎么样我不知道,加班肯定很多
Cloud native management practice: business led Devops continuous delivery system
随机推荐
What kind of framework is friendly to developers?
C# 值类型和引用类型讲解
机器学习之分类模型评估指标及sklearn代码实现
redis命令[逐渐完善]
Basic part 2 of flowable
[machine learning] logistic regression code exercise
Parameter initialization
工业测控设备内生信息安全技术研究综述
Webassembly 2022 questionnaire results are fresh
Pyqt5 rapid development and practice 6.5 qgridlayout (grid layout)
Trie树(字典树)讲解
mysql怎么换成中文
Shutter gradient
如何介绍自己的项目经验?
Cloud native management practice: business led Devops continuous delivery system
Unity guidance system. Click the target object and prompt the text to change color to enter the next step
redis可视化工具读取数据乱码问题解决
Redis command [gradually improved]
Nucleic acid scanning code registration experience (how to improve the correct character recognition rate of OCR)
MySQL的数据类型