python learning -pytest (four) -Pytest integrated Allure generate test reports

Pytest integrated Allure generate test reports

1, Allure installation

1) Demo style Allure report (it is not very pretty)

2) Allure downloads

Select the desired version, download the zip file, extract to

2, add the environment variable allure

path:D:\Program Files\allure-2.13.1\bin

3, see the reports generated allure

1. Generate reports allure

# 要先进入到allure生成的报告文件夹上级目录
cmd:allure serve allure生成的报告文件夹

It will automatically jump to the start  http://192.168.11.1:54011/  open test report

2. The test report generation evolution. . .

View test report as above, too much trouble, we can take one more step, some of the simple view reports

cmd:allure generate <allure测试结果目录> -o <存放报告的目录> --clean

Executing the will get a folder

This opens the test report with test data report first view is the same, when you do not need to open each time you enter the command in the dos window, but this can be directly in the browser to open PyCharm, if you say when you send someone else to see, you can not directly use the browser to open, the need to open a web service, as follows

cmd:allure open 测试报告文件夹路径

After the implementation, the browser will automatically open  http://192.168.11.1:56224/  View Report

4, pytest integrated allure generate test reports

1) mounted allure-pytest library

pip install allure-pytest

2) Use allure generate test reports

pytest.main(['-s', "--alluredir=reports/allure"])
# 使用os模块等待allure测试报告生成后,进行进化测试报告
os.system("allure generate <allure测试结果目录> -o <存放报告的目录> --clean")
Generated reports are stored json format, save the log to a text txt

The test report is saved in the evolution of the entire project

5, allure integrated jenkins

1) jenkins Allure plug-in installation

Online installation Allure

Offline installation Allure
Download Allure plug ① Address: https://updates.jenkins.io/download/plugins/allure-jenkins-plugin/
② select the corresponding version can be downloaded

③ offline installation, advanced into the inside, to upload the plugin, the option to download the plug-in, click on upload, you can install offline

2) Configuration jenkins global tool path (two modes, select one), the path of the installation package allure

Configure global tool path into a project, you can see Allure Report icon

3) projects which build operation, add allure path test report

4) Allure view the generated test report

Explicit is better than implicit (understood better than obscure)

I hope for your help! thanks for watching!
To reprint, please indicate the source:
Reprinted from: https://www.cnblogs.com/desireyang/ , thank you!

Pytest integrated Allure generate test reports

1, Allure installation

1) Demo style Allure report (it is not very pretty)

2) Allure downloads

Select the desired version, download the zip file, extract to

2, add the environment variable allure

path:D:\Program Files\allure-2.13.1\bin

3, see the reports generated allure

1. Generate reports allure

# 要先进入到allure生成的报告文件夹上级目录
cmd:allure serve allure生成的报告文件夹

It will automatically jump to the start  http://192.168.11.1:54011/  open test report

2. The test report generation evolution. . .

View test report as above, too much trouble, we can take one more step, some of the simple view reports

cmd:allure generate <allure测试结果目录> -o <存放报告的目录> --clean

Executing the will get a folder

This opens the test report with test data report first view is the same, when you do not need to open each time you enter the command in the dos window, but this can be directly in the browser to open PyCharm, if you say when you send someone else to see, you can not directly use the browser to open, the need to open a web service, as follows

cmd:allure open 测试报告文件夹路径

After the implementation, the browser will automatically open  http://192.168.11.1:56224/  View Report

4, pytest integrated allure generate test reports

1) mounted allure-pytest library

pip install allure-pytest

2) Use allure generate test reports

pytest.main(['-s', "--alluredir=reports/allure"])
# 使用os模块等待allure测试报告生成后,进行进化测试报告
os.system("allure generate <allure测试结果目录> -o <存放报告的目录> --clean")
Generated reports are stored json format, save the log to a text txt

The test report is saved in the evolution of the entire project

5, allure integrated jenkins

1) jenkins Allure plug-in installation

Online installation Allure

Offline installation Allure
Download Allure plug ① Address: https://updates.jenkins.io/download/plugins/allure-jenkins-plugin/
② select the corresponding version can be downloaded

③ offline installation, advanced into the inside, to upload the plugin, the option to download the plug-in, click on upload, you can install offline

2) Configuration jenkins global tool path (two modes, select one), the path of the installation package allure

Configure global tool path into a project, you can see Allure Report icon

3) projects which build operation, add allure path test report

4) Allure view the generated test report

Guess you like

Origin www.cnblogs.com/zhaocbbb/p/12543518.html