0
# Command Line Interface
1
2
Command-line options for controlling Allure reporting behavior, output configuration, and basic test execution settings.
3
4
## Capabilities
5
6
### Report Output Configuration
7
8
Configure where and how Allure test results are generated, including directory management and output cleanup.
9
10
```python { .api }
11
--alluredir DIR
12
"""
13
Generate Allure report in the specified directory.
14
15
Parameters:
16
- DIR: Path to directory for Allure test results (may not exist)
17
18
Usage:
19
pytest --alluredir=./allure-results tests/
20
"""
21
22
--clean-alluredir
23
"""
24
Clean alluredir folder if it exists before generating new results.
25
26
Usage:
27
pytest --alluredir=./results --clean-alluredir tests/
28
"""
29
```
30
31
### Capture Control
32
33
Control what test output and logging information is attached to Allure reports.
34
35
```python { .api }
36
--allure-no-capture
37
"""
38
Do not attach pytest captured logging/stdout/stderr to report.
39
40
By default, the plugin attaches:
41
- pytest captured stdout
42
- pytest captured stderr
43
- pytest captured logging
44
45
Usage:
46
pytest --alluredir=./results --allure-no-capture tests/
47
"""
48
```
49
50
### Test Plan Integration
51
52
Control test execution based on Allure test plans and inversion logic.
53
54
```python { .api }
55
--inversion
56
"""
57
Run tests NOT in testplan (inverse selection).
58
59
When a testplan is provided, normally only tests in the plan are executed.
60
This option runs all tests EXCEPT those in the testplan.
61
62
Usage:
63
pytest --alluredir=./results --inversion tests/
64
"""
65
```
66
67
### Link Pattern Configuration
68
69
Configure URL patterns for different link types to enable short link references in tests.
70
71
```python { .api }
72
--allure-link-pattern LINK_TYPE:LINK_PATTERN
73
"""
74
Define URL pattern for link type to enable short links in tests.
75
76
Parameters:
77
- LINK_TYPE: Type of link (e.g., 'issue', 'tms', 'test_case')
78
- LINK_PATTERN: Python format string with {} placeholder for link value
79
80
Usage:
81
pytest --allure-link-pattern issue:https://jira.company.com/browse/{} tests/
82
83
Then in tests:
84
@allure.link("PROJ-123", link_type="issue") # Expands to full URL
85
"""
86
```
87
88
## Usage Examples
89
90
### Basic Report Generation
91
92
```bash
93
# Generate Allure results in specific directory
94
pytest --alluredir=./allure-results tests/
95
96
# Clean directory before generating results
97
pytest --alluredir=./results --clean-alluredir tests/
98
99
# Generate results without captured output
100
pytest --alluredir=./results --allure-no-capture tests/
101
```
102
103
### Link Pattern Setup
104
105
```bash
106
# Configure multiple link patterns
107
pytest \
108
--allure-link-pattern issue:https://jira.company.com/browse/{} \
109
--allure-link-pattern tms:https://testmanagement.company.com/test/{} \
110
--alluredir=./results tests/
111
```
112
113
### Test Plan Integration
114
115
```bash
116
# Run only tests in test plan
117
ALLURE_TESTPLAN_FILE=testplan.json pytest --alluredir=./results tests/
118
119
# Run all tests EXCEPT those in test plan
120
ALLURE_TESTPLAN_FILE=testplan.json pytest --alluredir=./results --inversion tests/
121
```