Allure installation and use

1. Install pytest

pip install pytest

2. Install allure-pytest

pip install allure-pytest

3. Install the allure2 tool

Download link : https://github.com/allure-framework/allure2/releases
Download the compressed package. After decompression, put the bin directory into the system environment variable path and
enter 'allure --help' in cmd to check whether the installation is successful

Windows download compressed package

4. Run the test test case and save the running result to the target directory

pytest [directory/file path of test case] --alluredir [run result directory]

insert image description here

5. Generate allure report

allure [operation result directory] -o [report storage directory] --clean

Generate the history folder in the [Operation Result Directory] folder and copy it to the [Report Storage Directory] (to generate use case history records), the purpose is to display historical operation data

xcopy [operation result directory]\history [report storage directory]\history /e /y /i

6. View the report

allure serve [operation result directory]

or

allure open [report storage directory]

6. Usage of decorators in allure-pytest library

  • epic: first-level directory
  • feature: secondary directory
  • story: third-level directory
  • suit: test suite
  • title: used on the case, instead of the original case name displayed in the report
  • description: the description of the use case, displayed in the report
  • severity: the priority of the use case, the default is normal
    1) blocker level: interrupt defect (the client program does not respond, and cannot perform the next operation)
    2) critical level: critical defect (missing function points)
    3) normal level: normal
    4) minor level: minor defects (interface errors do not meet UI requirements)
    5) trivial level: minor defects (must-enter items without prompts, or prompts are not standardized)
  • step: Written in the use case, the execution steps of the case in the report, usage:
    with allure.step(''):
  • The print() statement will be output to the execution result of the report

Example:
insert image description here

7. Result display

insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/Jomei_Z/article/details/108864620