qastudio-pytest 1.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qastudio_pytest-1.0.5/LICENSE +21 -0
- qastudio_pytest-1.0.5/PKG-INFO +310 -0
- qastudio_pytest-1.0.5/README.md +273 -0
- qastudio_pytest-1.0.5/pyproject.toml +89 -0
- qastudio_pytest-1.0.5/setup.cfg +4 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest/__init__.py +13 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest/api_client.py +379 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest/models.py +259 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest/plugin.py +505 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest/utils.py +284 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest.egg-info/PKG-INFO +310 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest.egg-info/SOURCES.txt +15 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest.egg-info/dependency_links.txt +1 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest.egg-info/entry_points.txt +2 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest.egg-info/requires.txt +10 -0
- qastudio_pytest-1.0.5/src/qastudio_pytest.egg-info/top_level.txt +1 -0
- qastudio_pytest-1.0.5/tests/test_utils.py +148 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 QAStudio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qastudio-pytest
|
|
3
|
+
Version: 1.0.5
|
|
4
|
+
Summary: pytest plugin for QAStudio.dev test management platform
|
|
5
|
+
Author-email: QAStudio <ben@qastudio.dev>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/QAStudio-Dev/playwright-reporter-python
|
|
8
|
+
Project-URL: Repository, https://github.com/QAStudio-Dev/playwright-reporter-python
|
|
9
|
+
Project-URL: Issues, https://github.com/QAStudio-Dev/playwright-reporter-python/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/QAStudio-Dev/playwright-reporter-python#readme
|
|
11
|
+
Keywords: pytest,testing,test-management,qa,qastudio
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: Pytest
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pytest>=7.0.0
|
|
28
|
+
Requires-Dist: requests>=2.28.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: types-requests>=2.28.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# QAStudio pytest Plugin
|
|
39
|
+
|
|
40
|
+
A pytest plugin that integrates with [QAStudio.dev](https://qastudio.dev) test management platform.
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- 🔄 Automatic test result reporting to QAStudio.dev
|
|
45
|
+
- 📊 Real-time test run tracking
|
|
46
|
+
- 🏷️ Test case linking via markers or test IDs
|
|
47
|
+
- 📸 Screenshot and attachment support
|
|
48
|
+
- 🔧 Configurable via pytest.ini, command line, or environment variables
|
|
49
|
+
- 🎯 Batch result submission for performance
|
|
50
|
+
- 🛡️ Silent mode - won't fail tests if API is unavailable
|
|
51
|
+
- 📝 Error code snippets with context around failure points
|
|
52
|
+
- 📍 Precise error location tracking (file, line, column)
|
|
53
|
+
- 📤 Console output capture (stdout/stderr)
|
|
54
|
+
- 🔍 Enhanced debugging context for test failures
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install qastudio-pytest
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Quick Start
|
|
63
|
+
|
|
64
|
+
### 1. Configure via pytest.ini
|
|
65
|
+
|
|
66
|
+
```ini
|
|
67
|
+
[pytest]
|
|
68
|
+
qastudio_api_url = https://qastudio.dev/api
|
|
69
|
+
qastudio_api_key = your-api-key
|
|
70
|
+
qastudio_project_id = your-project-id
|
|
71
|
+
qastudio_environment = CI
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 2. Configure via Environment Variables
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
export QASTUDIO_API_URL=https://qastudio.dev/api
|
|
78
|
+
export QASTUDIO_API_KEY=your-api-key
|
|
79
|
+
export QASTUDIO_PROJECT_ID=your-project-id
|
|
80
|
+
export QASTUDIO_ENVIRONMENT=CI
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 3. Configure via Command Line
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pytest --qastudio-api-url=https://qastudio.dev/api \
|
|
87
|
+
--qastudio-api-key=your-api-key \
|
|
88
|
+
--qastudio-project-id=your-project-id
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Usage
|
|
92
|
+
|
|
93
|
+
### Linking Tests to QAStudio Test Cases
|
|
94
|
+
|
|
95
|
+
#### Method 1: Using pytest markers
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
import pytest
|
|
99
|
+
|
|
100
|
+
@pytest.mark.qastudio_id("QA-123")
|
|
101
|
+
def test_login():
|
|
102
|
+
assert user.login("user", "pass")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Method 2: Using test ID in test name
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
def test_QA123_login():
|
|
109
|
+
"""Test case QA-123"""
|
|
110
|
+
assert user.login("user", "pass")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Method 3: Using docstring
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
def test_login():
|
|
117
|
+
"""
|
|
118
|
+
Test user login functionality
|
|
119
|
+
|
|
120
|
+
QAStudio ID: QA-123
|
|
121
|
+
"""
|
|
122
|
+
assert user.login("user", "pass")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Adding Custom Metadata
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import pytest
|
|
129
|
+
|
|
130
|
+
@pytest.mark.qastudio_id("QA-456")
|
|
131
|
+
@pytest.mark.qastudio_priority("high")
|
|
132
|
+
@pytest.mark.qastudio_tags("smoke", "authentication")
|
|
133
|
+
def test_important_feature():
|
|
134
|
+
assert True
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Configuration Options
|
|
138
|
+
|
|
139
|
+
| Option | Environment Variable | Description | Default |
|
|
140
|
+
|--------|---------------------|-------------|---------|
|
|
141
|
+
| `qastudio_api_url` | `QASTUDIO_API_URL` | QAStudio.dev API URL | `https://qastudio.dev/api` |
|
|
142
|
+
| `qastudio_api_key` | `QASTUDIO_API_KEY` | API authentication key | Required |
|
|
143
|
+
| `qastudio_project_id` | `QASTUDIO_PROJECT_ID` | Project ID | Required |
|
|
144
|
+
| `qastudio_environment` | `QASTUDIO_ENVIRONMENT` | Environment name | `default` |
|
|
145
|
+
| `qastudio_test_run_name` | `QASTUDIO_TEST_RUN_NAME` | Custom test run name | Auto-generated |
|
|
146
|
+
| `qastudio_test_run_id` | `QASTUDIO_TEST_RUN_ID` | Existing test run ID | None |
|
|
147
|
+
| `qastudio_create_test_run` | `QASTUDIO_CREATE_TEST_RUN` | Create new test run | `true` |
|
|
148
|
+
| `qastudio_batch_size` | `QASTUDIO_BATCH_SIZE` | Results batch size | `10` |
|
|
149
|
+
| `qastudio_silent` | `QASTUDIO_SILENT` | Fail silently on API errors | `true` |
|
|
150
|
+
| `qastudio_verbose` | `QASTUDIO_VERBOSE` | Enable verbose logging | `false` |
|
|
151
|
+
| `qastudio_include_error_snippet` | `QASTUDIO_INCLUDE_ERROR_SNIPPET` | Include error code snippet | `true` |
|
|
152
|
+
| `qastudio_include_error_location` | `QASTUDIO_INCLUDE_ERROR_LOCATION` | Include precise error location | `true` |
|
|
153
|
+
| `qastudio_include_test_steps` | `QASTUDIO_INCLUDE_TEST_STEPS` | Include test execution steps | `true` |
|
|
154
|
+
| `qastudio_include_console_output` | `QASTUDIO_INCLUDE_CONSOLE_OUTPUT` | Include console output | `false` |
|
|
155
|
+
|
|
156
|
+
## Error Context and Debugging
|
|
157
|
+
|
|
158
|
+
The plugin automatically captures rich debugging context for failed tests:
|
|
159
|
+
|
|
160
|
+
### Error Code Snippets
|
|
161
|
+
|
|
162
|
+
When a test fails, the plugin captures the relevant code snippet showing where the error occurred:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
def test_calculation():
|
|
166
|
+
result = calculate(5, 0) # This line will be captured in the error snippet
|
|
167
|
+
assert result == 10
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Disable with:
|
|
171
|
+
```ini
|
|
172
|
+
[pytest]
|
|
173
|
+
qastudio_include_error_snippet = false
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Error Location
|
|
177
|
+
|
|
178
|
+
Precise error location information (file path, line number) is automatically captured:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"errorLocation": {
|
|
183
|
+
"file": "tests/test_example.py",
|
|
184
|
+
"line": 42,
|
|
185
|
+
"column": 0
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Disable with:
|
|
191
|
+
```ini
|
|
192
|
+
[pytest]
|
|
193
|
+
qastudio_include_error_location = false
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Console Output
|
|
197
|
+
|
|
198
|
+
Capture stdout and stderr from test execution (disabled by default to avoid sensitive data):
|
|
199
|
+
|
|
200
|
+
```ini
|
|
201
|
+
[pytest]
|
|
202
|
+
qastudio_include_console_output = true
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Or via command line:
|
|
206
|
+
```bash
|
|
207
|
+
pytest --qastudio-include-console-output
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Advanced Usage
|
|
211
|
+
|
|
212
|
+
### Using with pytest-xdist (Parallel Testing)
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pytest -n auto --qastudio-api-key=your-api-key
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The plugin handles parallel test execution automatically.
|
|
219
|
+
|
|
220
|
+
### CI/CD Integration
|
|
221
|
+
|
|
222
|
+
#### GitHub Actions
|
|
223
|
+
|
|
224
|
+
```yaml
|
|
225
|
+
- name: Run Tests
|
|
226
|
+
run: |
|
|
227
|
+
pytest --junitxml=report.xml
|
|
228
|
+
env:
|
|
229
|
+
QASTUDIO_API_KEY: ${{ secrets.QASTUDIO_API_KEY }}
|
|
230
|
+
QASTUDIO_PROJECT_ID: ${{ secrets.QASTUDIO_PROJECT_ID }}
|
|
231
|
+
QASTUDIO_ENVIRONMENT: CI
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### GitLab CI
|
|
235
|
+
|
|
236
|
+
```yaml
|
|
237
|
+
test:
|
|
238
|
+
script:
|
|
239
|
+
- pytest
|
|
240
|
+
variables:
|
|
241
|
+
QASTUDIO_API_KEY: $QASTUDIO_API_KEY
|
|
242
|
+
QASTUDIO_PROJECT_ID: $QASTUDIO_PROJECT_ID
|
|
243
|
+
QASTUDIO_ENVIRONMENT: CI
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Examples
|
|
247
|
+
|
|
248
|
+
### Playwright Example
|
|
249
|
+
|
|
250
|
+
A complete Playwright test framework example is available in `examples/playwright_tests/`:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Navigate to example directory
|
|
254
|
+
cd examples/playwright_tests
|
|
255
|
+
|
|
256
|
+
# Install dependencies
|
|
257
|
+
pip install -r requirements.txt
|
|
258
|
+
playwright install chromium
|
|
259
|
+
|
|
260
|
+
# Run the tests
|
|
261
|
+
./run_tests.sh
|
|
262
|
+
|
|
263
|
+
# Or run directly with pytest
|
|
264
|
+
pytest -v
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
The example demonstrates:
|
|
268
|
+
- ✅ Testing the QAStudio.dev website
|
|
269
|
+
- ✅ Automatic screenshot capture
|
|
270
|
+
- ✅ Playwright trace recording (`.zip` files)
|
|
271
|
+
- ✅ Integration with qastudio-pytest reporter
|
|
272
|
+
- ✅ Test case linking with `@pytest.mark.qastudio_id()`
|
|
273
|
+
|
|
274
|
+
See [`examples/playwright_tests/README.md`](examples/playwright_tests/README.md) for detailed documentation.
|
|
275
|
+
|
|
276
|
+
## Development
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Clone repository
|
|
280
|
+
git clone https://github.com/QAStudio-Dev/playwright-reporter-python.git
|
|
281
|
+
cd playwright-reporter-python
|
|
282
|
+
|
|
283
|
+
# Create virtual environment
|
|
284
|
+
python -m venv venv
|
|
285
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
286
|
+
|
|
287
|
+
# Install in development mode
|
|
288
|
+
pip install -e .[dev]
|
|
289
|
+
|
|
290
|
+
# Run tests
|
|
291
|
+
pytest tests/
|
|
292
|
+
|
|
293
|
+
# Run linting
|
|
294
|
+
black src/ tests/
|
|
295
|
+
flake8 src/ tests/
|
|
296
|
+
mypy src/
|
|
297
|
+
|
|
298
|
+
# Build package
|
|
299
|
+
python -m build
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## License
|
|
303
|
+
|
|
304
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
305
|
+
|
|
306
|
+
## Support
|
|
307
|
+
|
|
308
|
+
- 📧 Email: ben@qastudio.dev
|
|
309
|
+
- 🐛 Issues: https://github.com/QAStudio-Dev/playwright-reporter-python/issues
|
|
310
|
+
- 📖 Documentation: https://qastudio.dev/docs
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# QAStudio pytest Plugin
|
|
2
|
+
|
|
3
|
+
A pytest plugin that integrates with [QAStudio.dev](https://qastudio.dev) test management platform.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔄 Automatic test result reporting to QAStudio.dev
|
|
8
|
+
- 📊 Real-time test run tracking
|
|
9
|
+
- 🏷️ Test case linking via markers or test IDs
|
|
10
|
+
- 📸 Screenshot and attachment support
|
|
11
|
+
- 🔧 Configurable via pytest.ini, command line, or environment variables
|
|
12
|
+
- 🎯 Batch result submission for performance
|
|
13
|
+
- 🛡️ Silent mode - won't fail tests if API is unavailable
|
|
14
|
+
- 📝 Error code snippets with context around failure points
|
|
15
|
+
- 📍 Precise error location tracking (file, line, column)
|
|
16
|
+
- 📤 Console output capture (stdout/stderr)
|
|
17
|
+
- 🔍 Enhanced debugging context for test failures
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install qastudio-pytest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. Configure via pytest.ini
|
|
28
|
+
|
|
29
|
+
```ini
|
|
30
|
+
[pytest]
|
|
31
|
+
qastudio_api_url = https://qastudio.dev/api
|
|
32
|
+
qastudio_api_key = your-api-key
|
|
33
|
+
qastudio_project_id = your-project-id
|
|
34
|
+
qastudio_environment = CI
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Configure via Environment Variables
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export QASTUDIO_API_URL=https://qastudio.dev/api
|
|
41
|
+
export QASTUDIO_API_KEY=your-api-key
|
|
42
|
+
export QASTUDIO_PROJECT_ID=your-project-id
|
|
43
|
+
export QASTUDIO_ENVIRONMENT=CI
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Configure via Command Line
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pytest --qastudio-api-url=https://qastudio.dev/api \
|
|
50
|
+
--qastudio-api-key=your-api-key \
|
|
51
|
+
--qastudio-project-id=your-project-id
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
### Linking Tests to QAStudio Test Cases
|
|
57
|
+
|
|
58
|
+
#### Method 1: Using pytest markers
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import pytest
|
|
62
|
+
|
|
63
|
+
@pytest.mark.qastudio_id("QA-123")
|
|
64
|
+
def test_login():
|
|
65
|
+
assert user.login("user", "pass")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### Method 2: Using test ID in test name
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
def test_QA123_login():
|
|
72
|
+
"""Test case QA-123"""
|
|
73
|
+
assert user.login("user", "pass")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Method 3: Using docstring
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
def test_login():
|
|
80
|
+
"""
|
|
81
|
+
Test user login functionality
|
|
82
|
+
|
|
83
|
+
QAStudio ID: QA-123
|
|
84
|
+
"""
|
|
85
|
+
assert user.login("user", "pass")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Adding Custom Metadata
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import pytest
|
|
92
|
+
|
|
93
|
+
@pytest.mark.qastudio_id("QA-456")
|
|
94
|
+
@pytest.mark.qastudio_priority("high")
|
|
95
|
+
@pytest.mark.qastudio_tags("smoke", "authentication")
|
|
96
|
+
def test_important_feature():
|
|
97
|
+
assert True
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Configuration Options
|
|
101
|
+
|
|
102
|
+
| Option | Environment Variable | Description | Default |
|
|
103
|
+
|--------|---------------------|-------------|---------|
|
|
104
|
+
| `qastudio_api_url` | `QASTUDIO_API_URL` | QAStudio.dev API URL | `https://qastudio.dev/api` |
|
|
105
|
+
| `qastudio_api_key` | `QASTUDIO_API_KEY` | API authentication key | Required |
|
|
106
|
+
| `qastudio_project_id` | `QASTUDIO_PROJECT_ID` | Project ID | Required |
|
|
107
|
+
| `qastudio_environment` | `QASTUDIO_ENVIRONMENT` | Environment name | `default` |
|
|
108
|
+
| `qastudio_test_run_name` | `QASTUDIO_TEST_RUN_NAME` | Custom test run name | Auto-generated |
|
|
109
|
+
| `qastudio_test_run_id` | `QASTUDIO_TEST_RUN_ID` | Existing test run ID | None |
|
|
110
|
+
| `qastudio_create_test_run` | `QASTUDIO_CREATE_TEST_RUN` | Create new test run | `true` |
|
|
111
|
+
| `qastudio_batch_size` | `QASTUDIO_BATCH_SIZE` | Results batch size | `10` |
|
|
112
|
+
| `qastudio_silent` | `QASTUDIO_SILENT` | Fail silently on API errors | `true` |
|
|
113
|
+
| `qastudio_verbose` | `QASTUDIO_VERBOSE` | Enable verbose logging | `false` |
|
|
114
|
+
| `qastudio_include_error_snippet` | `QASTUDIO_INCLUDE_ERROR_SNIPPET` | Include error code snippet | `true` |
|
|
115
|
+
| `qastudio_include_error_location` | `QASTUDIO_INCLUDE_ERROR_LOCATION` | Include precise error location | `true` |
|
|
116
|
+
| `qastudio_include_test_steps` | `QASTUDIO_INCLUDE_TEST_STEPS` | Include test execution steps | `true` |
|
|
117
|
+
| `qastudio_include_console_output` | `QASTUDIO_INCLUDE_CONSOLE_OUTPUT` | Include console output | `false` |
|
|
118
|
+
|
|
119
|
+
## Error Context and Debugging
|
|
120
|
+
|
|
121
|
+
The plugin automatically captures rich debugging context for failed tests:
|
|
122
|
+
|
|
123
|
+
### Error Code Snippets
|
|
124
|
+
|
|
125
|
+
When a test fails, the plugin captures the relevant code snippet showing where the error occurred:
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
def test_calculation():
|
|
129
|
+
result = calculate(5, 0) # This line will be captured in the error snippet
|
|
130
|
+
assert result == 10
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Disable with:
|
|
134
|
+
```ini
|
|
135
|
+
[pytest]
|
|
136
|
+
qastudio_include_error_snippet = false
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Error Location
|
|
140
|
+
|
|
141
|
+
Precise error location information (file path, line number) is automatically captured:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"errorLocation": {
|
|
146
|
+
"file": "tests/test_example.py",
|
|
147
|
+
"line": 42,
|
|
148
|
+
"column": 0
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Disable with:
|
|
154
|
+
```ini
|
|
155
|
+
[pytest]
|
|
156
|
+
qastudio_include_error_location = false
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Console Output
|
|
160
|
+
|
|
161
|
+
Capture stdout and stderr from test execution (disabled by default to avoid sensitive data):
|
|
162
|
+
|
|
163
|
+
```ini
|
|
164
|
+
[pytest]
|
|
165
|
+
qastudio_include_console_output = true
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Or via command line:
|
|
169
|
+
```bash
|
|
170
|
+
pytest --qastudio-include-console-output
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Advanced Usage
|
|
174
|
+
|
|
175
|
+
### Using with pytest-xdist (Parallel Testing)
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pytest -n auto --qastudio-api-key=your-api-key
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The plugin handles parallel test execution automatically.
|
|
182
|
+
|
|
183
|
+
### CI/CD Integration
|
|
184
|
+
|
|
185
|
+
#### GitHub Actions
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
- name: Run Tests
|
|
189
|
+
run: |
|
|
190
|
+
pytest --junitxml=report.xml
|
|
191
|
+
env:
|
|
192
|
+
QASTUDIO_API_KEY: ${{ secrets.QASTUDIO_API_KEY }}
|
|
193
|
+
QASTUDIO_PROJECT_ID: ${{ secrets.QASTUDIO_PROJECT_ID }}
|
|
194
|
+
QASTUDIO_ENVIRONMENT: CI
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### GitLab CI
|
|
198
|
+
|
|
199
|
+
```yaml
|
|
200
|
+
test:
|
|
201
|
+
script:
|
|
202
|
+
- pytest
|
|
203
|
+
variables:
|
|
204
|
+
QASTUDIO_API_KEY: $QASTUDIO_API_KEY
|
|
205
|
+
QASTUDIO_PROJECT_ID: $QASTUDIO_PROJECT_ID
|
|
206
|
+
QASTUDIO_ENVIRONMENT: CI
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Examples
|
|
210
|
+
|
|
211
|
+
### Playwright Example
|
|
212
|
+
|
|
213
|
+
A complete Playwright test framework example is available in `examples/playwright_tests/`:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Navigate to example directory
|
|
217
|
+
cd examples/playwright_tests
|
|
218
|
+
|
|
219
|
+
# Install dependencies
|
|
220
|
+
pip install -r requirements.txt
|
|
221
|
+
playwright install chromium
|
|
222
|
+
|
|
223
|
+
# Run the tests
|
|
224
|
+
./run_tests.sh
|
|
225
|
+
|
|
226
|
+
# Or run directly with pytest
|
|
227
|
+
pytest -v
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The example demonstrates:
|
|
231
|
+
- ✅ Testing the QAStudio.dev website
|
|
232
|
+
- ✅ Automatic screenshot capture
|
|
233
|
+
- ✅ Playwright trace recording (`.zip` files)
|
|
234
|
+
- ✅ Integration with qastudio-pytest reporter
|
|
235
|
+
- ✅ Test case linking with `@pytest.mark.qastudio_id()`
|
|
236
|
+
|
|
237
|
+
See [`examples/playwright_tests/README.md`](examples/playwright_tests/README.md) for detailed documentation.
|
|
238
|
+
|
|
239
|
+
## Development
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Clone repository
|
|
243
|
+
git clone https://github.com/QAStudio-Dev/playwright-reporter-python.git
|
|
244
|
+
cd playwright-reporter-python
|
|
245
|
+
|
|
246
|
+
# Create virtual environment
|
|
247
|
+
python -m venv venv
|
|
248
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
249
|
+
|
|
250
|
+
# Install in development mode
|
|
251
|
+
pip install -e .[dev]
|
|
252
|
+
|
|
253
|
+
# Run tests
|
|
254
|
+
pytest tests/
|
|
255
|
+
|
|
256
|
+
# Run linting
|
|
257
|
+
black src/ tests/
|
|
258
|
+
flake8 src/ tests/
|
|
259
|
+
mypy src/
|
|
260
|
+
|
|
261
|
+
# Build package
|
|
262
|
+
python -m build
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
268
|
+
|
|
269
|
+
## Support
|
|
270
|
+
|
|
271
|
+
- 📧 Email: ben@qastudio.dev
|
|
272
|
+
- 🐛 Issues: https://github.com/QAStudio-Dev/playwright-reporter-python/issues
|
|
273
|
+
- 📖 Documentation: https://qastudio.dev/docs
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "qastudio-pytest"
|
|
7
|
+
version = "1.0.5"
|
|
8
|
+
description = "pytest plugin for QAStudio.dev test management platform"
|
|
9
|
+
authors = [{name = "QAStudio", email = "ben@qastudio.dev"}]
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
keywords = ["pytest", "testing", "test-management", "qa", "qastudio"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Framework :: Pytest",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Software Development :: Testing",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
dependencies = [
|
|
30
|
+
"pytest>=7.0.0",
|
|
31
|
+
"requests>=2.28.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
dev = [
|
|
36
|
+
"pytest>=7.0.0",
|
|
37
|
+
"pytest-cov>=4.0.0",
|
|
38
|
+
"black>=23.0.0",
|
|
39
|
+
"flake8>=6.0.0",
|
|
40
|
+
"mypy>=1.0.0",
|
|
41
|
+
"types-requests>=2.28.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/QAStudio-Dev/playwright-reporter-python"
|
|
46
|
+
Repository = "https://github.com/QAStudio-Dev/playwright-reporter-python"
|
|
47
|
+
Issues = "https://github.com/QAStudio-Dev/playwright-reporter-python/issues"
|
|
48
|
+
Documentation = "https://github.com/QAStudio-Dev/playwright-reporter-python#readme"
|
|
49
|
+
|
|
50
|
+
[project.entry-points.pytest11]
|
|
51
|
+
qastudio = "qastudio_pytest.plugin"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["src"]
|
|
55
|
+
|
|
56
|
+
[tool.black]
|
|
57
|
+
line-length = 100
|
|
58
|
+
target-version = ["py38", "py39", "py310", "py311", "py312"]
|
|
59
|
+
|
|
60
|
+
[tool.flake8]
|
|
61
|
+
max-line-length = 100
|
|
62
|
+
extend-ignore = ["E203", "W503"]
|
|
63
|
+
|
|
64
|
+
[tool.mypy]
|
|
65
|
+
python_version = "1.0.5"
|
|
66
|
+
warn_return_any = true
|
|
67
|
+
warn_unused_configs = true
|
|
68
|
+
disallow_untyped_defs = true
|
|
69
|
+
exclude = [
|
|
70
|
+
"venv/",
|
|
71
|
+
".venv/",
|
|
72
|
+
"build/",
|
|
73
|
+
"dist/",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
# Ignore errors in installed packages
|
|
77
|
+
[[tool.mypy.overrides]]
|
|
78
|
+
module = [
|
|
79
|
+
"pytest.*",
|
|
80
|
+
"_pytest.*",
|
|
81
|
+
]
|
|
82
|
+
ignore_errors = true
|
|
83
|
+
|
|
84
|
+
[tool.pytest.ini_options]
|
|
85
|
+
testpaths = ["tests"]
|
|
86
|
+
python_files = ["test_*.py"]
|
|
87
|
+
python_classes = ["Test*"]
|
|
88
|
+
python_functions = ["test_*"]
|
|
89
|
+
addopts = "-v --strict-markers"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""
|
|
2
|
+
QAStudio pytest plugin for test management integration.
|
|
3
|
+
|
|
4
|
+
This plugin automatically reports pytest test results to QAStudio.dev platform.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "1.0.5"
|
|
8
|
+
__author__ = "QAStudio"
|
|
9
|
+
__email__ = "support@qastudio.dev"
|
|
10
|
+
|
|
11
|
+
from .plugin import QAStudioPlugin
|
|
12
|
+
|
|
13
|
+
__all__ = ["QAStudioPlugin"]
|