Interface automation testing of Pytest+Jenkins+Allure

Table of contents

Generate Allure in two forms

Direct generation within a project does not depend on Jenkins

1. Install allure first, configure allure\bin to the environment variable cmd command line input: allure to verify whether the installation is successful

2. Generate the html file from the json file and execute allure generate report/ -o report/html where report/ is the generated json path, report/html is to generate an html folder under report,

The final test results are stored in it. All relative paths are used here, and absolute paths can also be used to generate them. The test results can be viewed through the generated html file under the file.

Second, display the Allure report with Jenkins

1. Install the corresponding plug-in HTML Publisher plugin in the system management -- plug-in management

 1. Next, install the execution tool of allure, after downloading, go to the system management to configure the allure commandline

Then configure the job and create a new item

 2/ Configure items

Add the directory where the local project is located

 3. Configure the build script. The script here is the test task to be executed and the json file needed to generate allure. For the convenience of understanding, I have used the absolute path to execute the previous tasks.

The path behind --alluredir is for storage, report is a folder for storing the generated json file, and the exit 0 behind is for the convenience of script exit, if not added, an error will be prompted during the construction process.

 4. The final task is to configure allure to generate json generated by batch processing. According to the previous execution command allure generate report/ -o report/html, we need to know the path to store json and specify a folder to store generated html

report12 is the path for storing and reading json, because the default path is set, here only need to configure the relative path,

Then click on advanced to display the configuration of allure report, and report1 is the path to store the generated HTML

 5. Then click Save to execute the build

 Then you can view the allure report on the check page. For the history record, you need to copy the history folder in report 1, otherwise the history record will be cleared every time it is executed.

 Click to enter the details page to view

Summarize:


Generate Allure in two forms

Direct generation within a project does not depend on Jenkins

1. Install allure first, configure allure\bin to the environment variable cmd command line input: allure to verify whether the installation is successful

2. Generate the html file from the json file and execute allure generate report/ -o report/html where report/ is the generated json path, report/html is to generate an html folder under report,

The final test results are stored in it. All relative paths are used here, and absolute paths can also be used to generate them. The test results can be viewed through the generated html file under the file.

Second, display the Allure report with Jenkins

1. Install the corresponding plug-in HTML Publisher plugin in the system management -- plug-in management

 1. Next, install the execution tool of allure, after downloading, go to the system management to configure the allure commandline

Then configure the job and create a new item

 2/ Configure items

Add the directory where the local project is located

 3. Configure the build script. The script here is the test task to be executed and the json file needed to generate allure. For the convenience of understanding, I have used the absolute path to execute the previous tasks.

The path behind --alluredir is for storage, report is a folder for storing the generated json file, and the exit 0 behind is for the convenience of script exit, if not added, an error will be prompted during the construction process.

 4. The final task is to configure allure to generate json generated by batch processing. According to the previous execution command allure generate report/ -o report/html, we need to know the path to store json and specify a folder to store generated html

report12 is the path for storing and reading json, because the default path is set, here only need to configure the relative path,

Then click on advanced to display the configuration of allure report, and report1 is the path to store the generated HTML

 5. Then click Save to execute the build

 Then you can view the allure report on the check page. For the history record, you need to copy the history folder in report 1, otherwise the history record will be cleared every time it is executed.

 Click to enter the details page to view

Summarize:

Thanks to everyone who read my article carefully! ! !

I personally sorted out some technical materials I have compiled in my software testing career in the past few years, including: e-books, resume modules, various job templates, interview books, self-study projects, etc. Welcome everyone to click on the business card below to get it for free, don't miss it.

   Python automated testing learning exchange group: a full set of automated testing interview resume learning materials to obtain Click the link to join the group chat [python automated testing exchange]: http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=DhOSZDNS -qzT5QKbFQMsfJ7DsrFfKpOF&authKey=eBt%2BF%2FBK81lVLcsLKaFqnvDAVA8IdNsGC7J0YV73w8V%2FJpdbby66r7vJ1rsPIifg&noverify=0&group_code=198408628

 

 

Supongo que te gusta

Origin blog.csdn.net/MXB_1220/article/details/131775377
Recomendado
Clasificación