当前位置:网站首页>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/simpleallure 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

边栏推荐
- Random number setting and reference between parameters
- Data type of MySQL
- I don't know how lucky the boy who randomly typed logs is. There must be a lot of overtime
- Unity3d hodgepodge
- 分布式Session共享的4类技术方案,与优劣势比较
- Floweable advanced
- [unity entry program] collection of common learning websites
- The use and Simulation of string function, character function and memory function
- 36. JS动画
- Floweable foundation Chapter 1
猜你喜欢

Retinal Vessel Segmentation via a Semantics and Multi-Scale Aggregation Network

网络安全(6)

Configuration file settings for remote connection to Windows version server redis

引入redis缓存出现的问题以及解决方式

mysql怎么换成中文

乱打日志的男孩运气怎么样我不知道,加班肯定很多

PyQt5快速开发与实战 6.1 好软件的三个维度 && 6.2 PyQt5中的布局管理 && 6.3 PyQt5的绝对位置布局

用户身份标识与账号体系实践

Emmet syntax

存算一体与存内计算计算杂谈
随机推荐
redis可视化工具读取数据乱码问题解决
What kind of framework is friendly to developers?
Solve the problem of reading data garbled by redis visualization tool
【BERT-多标签文本分类实战】之一——实战项目总览
How to export the old and new file names and locations to excel after file renaming
Unity Xchart3.0基本用法快速上手
36. JS animation
PyQt5快速开发与实战 6.4 QBoxLayout(框布局)
不用Swagger,那我用啥?
Nucleic acid scanning code registration experience (how to improve the correct character recognition rate of OCR)
(Video + graphics) introduction to machine learning series - Chapter 1 Introduction
I don't know how lucky the boy who randomly typed logs is. There must be a lot of overtime
使用cpolar发布树莓派网页(cpolar隧道的完善)
【集中培训】HCIP-Cloud Computing 资源交流帖
Custom configuration
常用的DOS命令[逐渐完善]
mysql怎么换成中文
Nutnews developed based on arkui ETS
使用cpolar发布树莓派网页(cpolar功能的完善)
Appendix 2 – some simple exercises