[pytest] Modify the logo and parameterization in the allure report

1. Pytest generates Allure report - change report logo

1. Find the Allure installation static directory file:

D:\python automation related information\pytest\allure-2.13.6\plugins\custom-logo-plugin\static

2. Save the logo file to be replaced in this directory: [and name it allure_logo.png]

insert image description here

3. Open the styles.css file in the directory at the same time:

Replace with the following:
.side-nav__brand { background: url('allure_logo.png') no-repeat left center !important;

url('allure_logo.png') means the logo to be loaded and displayed in the allure report

margin-left: 10px;
height: 40px;
background-size: contain !important;
}
.side-nav__brand span{ display: none; } .side-nav__brand:after{ content: "8-line Test"; #This is the content Corresponding to the content behind my logo, you can see in the next screenshot, if you don’t write this style, the default is allure margin-left: 10px;




}

4. Add it under the allure.yaml file in the D:\python automation related information\pytest\allure-2.13.6\config directory


  • Save and run again after adding the coustom-logo-plugin
    insert image description here

5. The replacement is successful:

insert image description here

2. How to modify the use case parameterization in the allure report:

2.1. Under normal circumstances: parameterization in the Allure report: (a long list)

insert image description here

2.2. Modification method:


Find line 95 of the D:\Python\Lib\site-packages\allure_pytest listener.py file in the python installation directory and modify it: (modify it as shown below)
insert image description here

3. Allure report link in the local LAN:

After using the command to generate the allure report locally, opening the general link in the project starts with localhost. At
insert image description here
this time, it is a problem to show the local report to colleagues in the form of a link. Then we need to open it separately:
find the local where the report is generated Directory:
insert image description here
We enter the html directory, and then: shift + right mouse button to enter powershell:
allure open 'the directory where the report is located' to generate a link
insert image description here
Click to enter the link to open the report:
insert image description here

Guess you like

Origin blog.csdn.net/weixin_52358204/article/details/125409612