File tree Expand file tree Collapse file tree 3 files changed +53
-0
lines changed
main/java/io/qameta/allure/spock2
test/groovy/io/qameta/allure/spock2 Expand file tree Collapse file tree 3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 4242import org .spockframework .runtime .model .MethodInfo ;
4343import org .spockframework .runtime .model .MethodKind ;
4444import org .spockframework .runtime .model .SpecInfo ;
45+ import org .spockframework .runtime .model .TestTag ;
4546
4647import java .lang .reflect .Method ;
4748import java .security .MessageDigest ;
@@ -185,6 +186,12 @@ public void beforeIteration(final IterationInfo iteration) {
185186 labels .add (createParentSuiteLabel (superSpec .getName ()));
186187 }
187188
189+ final List <Label > testTags = feature .getTestTags ().stream ()
190+ .map (TestTag ::getValue )
191+ .map (ResultsUtils ::createTagLabel )
192+ .collect (Collectors .toList ());
193+
194+ labels .addAll (testTags );
188195 labels .addAll (featureLabels );
189196 labels .addAll (specLabels );
190197 labels .addAll (getProvidedLabels ());
Original file line number Diff line number Diff line change 3939import io .qameta .allure .spock2 .samples .OneTest ;
4040import io .qameta .allure .spock2 .samples .ParametersTest ;
4141import io .qameta .allure .spock2 .samples .SpecFixtures ;
42+ import io .qameta .allure .spock2 .samples .SpockTags ;
4243import io .qameta .allure .spock2 .samples .StepsAndBlocks ;
4344import io .qameta .allure .spock2 .samples .TestWithAnnotations ;
4445import io .qameta .allure .spock2 .samples .TestWithAnnotationsOnClass ;
@@ -219,6 +220,19 @@ void shouldProcessMethodAnnotations() {
219220 );
220221 }
221222
223+ @ Test
224+ void shouldProcessSpockTags () {
225+ final AllureResults results = runClasses (SpockTags .class );
226+ assertThat (results .getTestResults ())
227+ .hasSize (1 )
228+ .flatExtracting (TestResult ::getLabels )
229+ .extracting (Label ::getName , Label ::getValue )
230+ .contains (
231+ tuple ("tag" , "first" ),
232+ tuple ("tag" , "second" )
233+ );
234+ }
235+
222236 @ Test
223237 void shouldProcessClassAnnotations () {
224238 final AllureResults results = runClasses (TestWithAnnotationsOnClass .class );
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2019 Qameta Software OÜ
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package io.qameta.allure.spock2.samples
17+
18+ import spock.lang.Specification
19+ import spock.lang.Tag
20+
21+ /**
22+ * @author charlie (Dmitry Baev).
23+ */
24+ class SpockTags extends Specification {
25+
26+ @Tag (" first" )
27+ @Tag (" second" )
28+ def " someTest" () {
29+ expect :
30+ true
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments