Skip to content

Commit 1fba8b7

Browse files
authored
Merge pull request #477 from qase-tms/feat/reporters-tags-support
feat: add test-level tags support to all reporters
2 parents df9038f + 49e090f commit 1fba8b7

32 files changed

Lines changed: 647 additions & 34 deletions

File tree

integration/behave/expected/behave-examples.yaml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ run:
44
failed: 0
55
invalid: 2
66
muted: 0
7-
passed: 16
7+
passed: 18
88
skipped: 1
9-
total: 19
9+
total: 21
1010
results:
1111
- title: Test in Authentication suite
1212
signature: 301::authentication::test_in_authentication_suite
@@ -351,3 +351,37 @@ results:
351351
action: Then the sum is 3
352352
execution:
353353
status: passed
354+
- title: Test with single tag
355+
signature: 901::features::tags.feature::test_with_single_tag
356+
testops_ids:
357+
- 901
358+
status: passed
359+
fields:
360+
tags: smoke
361+
relations:
362+
suite:
363+
data:
364+
- title: features
365+
- title: tags.feature
366+
steps:
367+
- data:
368+
action: Given a passing condition
369+
execution:
370+
status: passed
371+
- title: Test with multiple tags
372+
signature: 902::features::tags.feature::test_with_multiple_tags
373+
testops_ids:
374+
- 902
375+
status: passed
376+
fields:
377+
tags: smoke,regression,api
378+
relations:
379+
suite:
380+
data:
381+
- title: features
382+
- title: tags.feature
383+
steps:
384+
- data:
385+
action: Given a passing condition
386+
execution:
387+
status: passed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Feature: Tags tests
2+
3+
@qase.id:901 @qase.tags:smoke
4+
Scenario: Test with single tag
5+
Given a passing condition
6+
7+
@qase.id:902 @qase.tags:smoke,regression,api
8+
Scenario: Test with multiple tags
9+
Given a passing condition

integration/pytest/expected/pytest-examples.yaml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ run:
44
failed: 2
55
invalid: 0
66
muted: 0
7-
passed: 24
7+
passed: 28
88
skipped: 1
9-
total: 27
9+
total: 31
1010
results:
1111
- title: Muted test
1212
signature: 208::integration::pytest::tests::test_fields.py::test_muted
@@ -375,3 +375,51 @@ results:
375375
data:
376376
- title: integration/pytest/tests
377377
- title: test_basic
378+
- title: Test with single tag
379+
signature: 901::integration::pytest::tests::test_tags.py::test_single_tag
380+
testops_ids:
381+
- 901
382+
status: passed
383+
fields:
384+
tags: smoke
385+
relations:
386+
suite:
387+
data:
388+
- title: integration/pytest/tests
389+
- title: test_tags
390+
- title: Test with multiple tags
391+
signature: 902::integration::pytest::tests::test_tags.py::test_multiple_tags
392+
testops_ids:
393+
- 902
394+
status: passed
395+
fields:
396+
tags: smoke,regression,api
397+
relations:
398+
suite:
399+
data:
400+
- title: integration/pytest/tests
401+
- title: test_tags
402+
- title: Test with tags via fields
403+
signature: 903::integration::pytest::tests::test_tags.py::test_tags_via_fields
404+
testops_ids:
405+
- 903
406+
status: passed
407+
fields:
408+
tags: fromfield
409+
relations:
410+
suite:
411+
data:
412+
- title: integration/pytest/tests
413+
- title: test_tags
414+
- title: Test with merged tags
415+
signature: 904::integration::pytest::tests::test_tags.py::test_tags_merged
416+
testops_ids:
417+
- 904
418+
status: passed
419+
fields:
420+
tags: fromfield,api
421+
relations:
422+
suite:
423+
data:
424+
- title: integration/pytest/tests
425+
- title: test_tags
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Tests demonstrating tags support."""
2+
from qase.pytest import qase
3+
4+
5+
@qase.id(901)
6+
@qase.title("Test with single tag")
7+
@qase.tags("smoke")
8+
def test_single_tag():
9+
assert True
10+
11+
12+
@qase.id(902)
13+
@qase.title("Test with multiple tags")
14+
@qase.tags("smoke", "regression", "api")
15+
def test_multiple_tags():
16+
assert True
17+
18+
19+
@qase.id(903)
20+
@qase.title("Test with tags via fields")
21+
@qase.fields(("tags", "fromfield"))
22+
def test_tags_via_fields():
23+
assert True
24+
25+
26+
@qase.id(904)
27+
@qase.title("Test with merged tags")
28+
@qase.tags("api")
29+
@qase.fields(("tags", "fromfield"))
30+
def test_tags_merged():
31+
assert True

integration/robot/expected/robot-examples.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ run:
44
failed: 0
55
invalid: 1
66
muted: 0
7-
passed: 1
7+
passed: 3
88
skipped: 0
9-
total: 2
9+
total: 4
1010
results:
1111
- title: Test With Failing Step
1212
signature: 302::steps::test_with_failing_step
@@ -77,3 +77,27 @@ results:
7777
action: Should Be True Should Be True
7878
execution:
7979
status: passed
80+
- title: Test With Single Tag
81+
signature: 901::steps::test_with_single_tag
82+
testops_ids:
83+
- 901
84+
status: passed
85+
fields:
86+
description: Test with one tag
87+
tags: smoke
88+
relations:
89+
suite:
90+
data:
91+
- title: Steps
92+
- title: Test With Multiple Tags
93+
signature: 902::steps::test_with_multiple_tags
94+
testops_ids:
95+
- 902
96+
status: passed
97+
fields:
98+
description: Test with multiple tags
99+
tags: smoke,regression,api
100+
relations:
101+
suite:
102+
data:
103+
- title: Steps

integration/robot/tests/steps.robot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ Test With Failing Step
1313
Open Application
1414
Trigger Failure
1515

16+
Test With Single Tag
17+
[Documentation] Test with one tag
18+
[Tags] Q-901 qase.tags:smoke
19+
Should Be True ${TRUE}
20+
21+
Test With Multiple Tags
22+
[Documentation] Test with multiple tags
23+
[Tags] Q-902 qase.tags:smoke,regression,api
24+
Should Be True ${TRUE}
25+
1626
*** Keywords ***
1727
Open Application
1828
Log Application opened

integration/tavern/expected/tavern-examples.yaml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ run:
44
failed: 0
55
invalid: 1
66
muted: 0
7-
passed: 5
7+
passed: 7
88
skipped: 0
9-
total: 6
9+
total: 8
1010
results:
1111
- title: Get list of users
1212
signature: 101::test_api.tavern.yaml::qaseid=101_get_list_of_users
@@ -132,3 +132,45 @@ results:
132132
mime_type: application/json
133133
- file_name: response.json
134134
mime_type: application/json
135+
- title: Get tagged users
136+
signature: 901::test_api.tavern.yaml::qaseid=901_qasetags.smoke_get_tagged_users
137+
testops_ids:
138+
- 901
139+
status: passed
140+
fields:
141+
tags: smoke
142+
relations:
143+
suite:
144+
data:
145+
- title: test_api.tavern.yaml
146+
steps:
147+
- data:
148+
action: Fetch users with tag
149+
execution:
150+
status: passed
151+
attachments:
152+
- file_name: request.json
153+
mime_type: application/json
154+
- file_name: response.json
155+
mime_type: application/json
156+
- title: Get tagged posts
157+
signature: 902::test_api.tavern.yaml::qaseid=902_qasetags.smoke,regression,api_get_tagged_posts
158+
testops_ids:
159+
- 902
160+
status: passed
161+
fields:
162+
tags: smoke,regression,api
163+
relations:
164+
suite:
165+
data:
166+
- title: test_api.tavern.yaml
167+
steps:
168+
- data:
169+
action: Fetch posts with tags
170+
execution:
171+
status: passed
172+
attachments:
173+
- file_name: request.json
174+
mime_type: application/json
175+
- file_name: response.json
176+
mime_type: application/json

integration/tavern/tests/test_api.tavern.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,23 @@ stages:
6868
method: GET
6969
response:
7070
status_code: 200
71+
72+
---
73+
test_name: QaseID=901 QaseTags.smoke Get tagged users
74+
stages:
75+
- name: Fetch users with tag
76+
request:
77+
url: https://jsonplaceholder.typicode.com/users
78+
method: GET
79+
response:
80+
status_code: 200
81+
82+
---
83+
test_name: QaseID=902 QaseTags.smoke,regression,api Get tagged posts
84+
stages:
85+
- name: Fetch posts with tags
86+
request:
87+
url: https://jsonplaceholder.typicode.com/posts/1
88+
method: GET
89+
response:
90+
status_code: 200

qase-behave/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# qase-behave 3.1.0
2+
3+
## What's new
4+
5+
- Added support for test-level tags using the `@qase.tags:tag1,tag2` Gherkin tag. Feature and scenario tags are accumulated.
6+
17
# qase-behave 3.0.0
28

39
## What's new

qase-behave/docs/usage.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This guide provides comprehensive instructions for integrating Qase with Behave
1111
- [Adding QaseID](#adding-qaseid)
1212
- [Adding Fields](#adding-fields)
1313
- [Adding Suite](#adding-suite)
14+
- [Adding Tags](#adding-tags)
1415
- [Ignoring Tests](#ignoring-tests)
1516
- [Working with Attachments](#working-with-attachments)
1617
- [Multi-Project Support](#multi-project-support)
@@ -146,6 +147,34 @@ Feature: Authentication
146147

147148
---
148149

150+
## Adding Tags
151+
152+
Use the `@qase.tags:` tag to assign tags to scenarios. Tags are sent as a comma-separated string to the Qase API.
153+
154+
### Basic Usage
155+
156+
```gherkin
157+
@qase.id:1 @qase.tags:smoke,regression
158+
Scenario: Login test
159+
Given a passing condition
160+
```
161+
162+
### Feature and Scenario Merge
163+
164+
Tags from the feature level and scenario level are accumulated:
165+
166+
```gherkin
167+
@qase.tags:smoke
168+
Feature: Authentication
169+
170+
@qase.id:1 @qase.tags:regression
171+
Scenario: Login test
172+
# Tags: smoke, regression
173+
Given a passing condition
174+
```
175+
176+
---
177+
149178
## Ignoring Tests
150179

151180
Exclude scenarios from Qase reporting while still executing them:

0 commit comments

Comments
 (0)