diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6d1241d1..69f577fc1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,10 +19,10 @@ jobs: matrix: java-version: [ '17.0.x' ] steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4.1.1 - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: ${{ matrix.java-version }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1588f1359..75b78957e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,10 +8,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4.1.1 - name: "Set up JDK 17.0.x" - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '17.0.x' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21fe7321b..c2167b9d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: "Check next version" run: | expr "${{ github.event.inputs.nextVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$' - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4.1.1 with: token: ${{ secrets.QAMETA_CI }} diff --git a/README.md b/README.md index 668eac198..202c13479 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [twitter-team]: https://twitter.com/QametaSoftware/lists/team/members "Team" [CONTRIBUTING.md]: .github/CONTRIBUTING.md -[docs]: https://docs.qameta.io/allure/2.0/ +[docs]: https://allurereport.org/docs/ # Allure Java Integrations @@ -239,3 +239,18 @@ Usage example: ``` Awaitility.setDefaultConditionEvaluationListener(new AllureAwaitilityListener()); ``` + +## Cucumber +4,5,6,7 versions are supported instead of N use the required version. +To use Cucumber simply add the following dependency to your project: + +[How to use allure cucumber code examples](https://github.com/allure-examples?q=cucumber&type=all&language=java) + +```xml + + io.qameta.allure + allure-cucumberN-jvm + $LATEST_VERSION + + +``` diff --git a/allure-descriptions-javadoc/build.gradle.kts b/allure-descriptions-javadoc/build.gradle.kts index 266bcb3ab..4862cfc18 100644 --- a/allure-descriptions-javadoc/build.gradle.kts +++ b/allure-descriptions-javadoc/build.gradle.kts @@ -3,8 +3,6 @@ description = "Allure Javadoc Descriptions" val agent: Configuration by configurations.creating dependencies { - api("commons-io:commons-io") - api(project(":allure-java-commons")) testImplementation("com.google.testing.compile:compile-testing") testImplementation("io.github.glytching:junit-extensions") testImplementation("org.assertj:assertj-core") @@ -18,9 +16,11 @@ dependencies { tasks.jar { manifest { - attributes(mapOf( + attributes( + mapOf( "Automatic-Module-Name" to "io.qameta.allure.description" - )) + ) + ) } } diff --git a/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/ClassNames.java b/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/ClassNames.java new file mode 100644 index 000000000..a6b225139 --- /dev/null +++ b/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/ClassNames.java @@ -0,0 +1,28 @@ +/* + * Copyright 2023 Qameta Software OÜ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.qameta.allure.description; + +/** + * @author charlie (Dmitry Baev). + */ +final class ClassNames { + + static final String DESCRIPTION_ANNOTATION = "io.qameta.allure.Description"; + + private ClassNames() { + throw new IllegalStateException("do not instance"); + } +} diff --git a/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionsProcessor.java b/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionsProcessor.java index 1ee9c5209..32ce95707 100644 --- a/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionsProcessor.java +++ b/allure-descriptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionsProcessor.java @@ -15,8 +15,6 @@ */ package io.qameta.allure.description; -import io.qameta.allure.Description; - import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; import javax.annotation.processing.Messager; @@ -28,24 +26,31 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; +import javax.lang.model.util.ElementFilter; import javax.lang.model.util.Elements; import javax.tools.Diagnostic; import javax.tools.FileObject; import javax.tools.StandardLocation; import java.io.IOException; import java.io.Writer; +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import static io.qameta.allure.util.ResultsUtils.generateMethodSignatureHash; +import static io.qameta.allure.description.ClassNames.DESCRIPTION_ANNOTATION; /** * @author Egor Borisov ehborisov@gmail.com */ -@SupportedAnnotationTypes("io.qameta.allure.Description") +@SupportedAnnotationTypes(DESCRIPTION_ANNOTATION) public class JavaDocDescriptionsProcessor extends AbstractProcessor { + private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/"; + private Filer filer; private Elements elementUtils; private Messager messager; @@ -66,27 +71,32 @@ public SourceVersion getSupportedSourceVersion() { @Override public boolean process(final Set annotations, final RoundEnvironment env) { - final Set elements = env.getElementsAnnotatedWith(Description.class); - elements.forEach(el -> { - if (!el.getAnnotation(Description.class).useJavaDoc()) { + final TypeElement typeElement = elementUtils.getTypeElement(DESCRIPTION_ANNOTATION); + final Set elements = env.getElementsAnnotatedWith(typeElement); + final Set methods = ElementFilter.methodsIn(elements); + methods.forEach(method -> { + final String rawDocs = elementUtils.getDocComment(method); + + if (rawDocs == null) { return; } - final String docs = elementUtils.getDocComment(el); - final List typeParams = ((ExecutableElement) el).getParameters().stream() - .map(this::methodParameterTypeMapper) - .collect(Collectors.toList()); - final String name = el.getSimpleName().toString(); - if (docs == null) { - messager.printMessage(Diagnostic.Kind.WARNING, - "Unable to create resource for method " + name + typeParams - + " as it does not have a docs comment"); + + final String docs = rawDocs.trim(); + if ("".equals(docs)) { return; } - final String hash = generateMethodSignatureHash(el.getEnclosingElement().toString(), name, typeParams); + final String name = method.getSimpleName().toString(); + final List typeParams = method.getParameters().stream() + .map(this::methodParameterTypeMapper) + .collect(Collectors.toList()); + + final String hash = generateMethodSignatureHash( + method.getEnclosingElement().toString(), name, typeParams + ); try { - final FileObject file = filer.createResource(StandardLocation.CLASS_OUTPUT, - "allureDescriptions", hash); + final FileObject file = filer.createResource(StandardLocation.CLASS_OUTPUT, "", + ALLURE_DESCRIPTIONS_FOLDER + hash); try (Writer writer = file.openWriter()) { writer.write(docs); } @@ -103,4 +113,29 @@ private String methodParameterTypeMapper(final VariableElement parameter) { final Element typeElement = processingEnv.getTypeUtils().asElement(parameter.asType()); return typeElement != null ? typeElement.toString() : parameter.asType().toString(); } + + private static String generateMethodSignatureHash(final String className, + final String methodName, + final List parameterTypes) { + final MessageDigest md = getMd5Digest(); + md.update(className.getBytes(StandardCharsets.UTF_8)); + md.update(methodName.getBytes(StandardCharsets.UTF_8)); + parameterTypes.stream() + .map(string -> string.getBytes(StandardCharsets.UTF_8)) + .forEach(md::update); + final byte[] bytes = md.digest(); + return bytesToHex(bytes); + } + + private static MessageDigest getMd5Digest() { + try { + return MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException("Can not find hashing algorithm", e); + } + } + + private static String bytesToHex(final byte[] bytes) { + return new BigInteger(1, bytes).toString(16); + } } diff --git a/allure-descriptions-javadoc/src/test/java/io/qameta/allure/description/ProcessDescriptionsTest.java b/allure-descriptions-javadoc/src/test/java/io/qameta/allure/description/ProcessDescriptionsTest.java index d285ea178..ff8f7dbdc 100644 --- a/allure-descriptions-javadoc/src/test/java/io/qameta/allure/description/ProcessDescriptionsTest.java +++ b/allure-descriptions-javadoc/src/test/java/io/qameta/allure/description/ProcessDescriptionsTest.java @@ -31,13 +31,13 @@ */ class ProcessDescriptionsTest { - private static final String ALLURE_PACKAGE_NAME = "allureDescriptions"; + private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/"; @Test void captureDescriptionTest() { final String expectedMethodSignatureHash = "4e7f896021ef2fce7c1deb7f5b9e38fb"; - JavaFileObject source = JavaFileObjects.forSourceLines( + final JavaFileObject source = JavaFileObjects.forSourceLines( "io.qameta.allure.description.test.DescriptionSample", "package io.qameta.allure.description.test;", "import io.qameta.allure.Description;", @@ -53,19 +53,55 @@ void captureDescriptionTest() { "}" ); - Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()) + final Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()) .withOptions("-Werror"); - Compilation compilation = compiler.compile(source); - assertThat(compilation).generatedFile( - StandardLocation.CLASS_OUTPUT, - ALLURE_PACKAGE_NAME, - expectedMethodSignatureHash + final Compilation compilation = compiler.compile(source); + assertThat(compilation) + .generatedFile( + StandardLocation.CLASS_OUTPUT, + "", + ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash + ) + .contentsAsUtf8String() + .isEqualTo("Captured javadoc description"); + } + + @Test + void captureDescriptionTestIfNoUseJavadocIsSpecified() { + final String expectedMethodSignatureHash = "4e7f896021ef2fce7c1deb7f5b9e38fb"; + + final JavaFileObject source = JavaFileObjects.forSourceLines( + "io.qameta.allure.description.test.DescriptionSample", + "package io.qameta.allure.description.test;", + "import io.qameta.allure.Description;", + "", + "public class DescriptionSample {", + "", + "/**", + "* Captured javadoc description", + "*/", + "@Description", + "public void sampleTest() {", + "}", + "}" ); + + final Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()) + .withOptions("-Werror"); + final Compilation compilation = compiler.compile(source); + assertThat(compilation) + .generatedFile( + StandardLocation.CLASS_OUTPUT, + "", + ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash + ) + .contentsAsUtf8String() + .contains("Captured javadoc description"); } @Test void skipUncommentedMethodTest() { - JavaFileObject source = JavaFileObjects.forSourceLines( + final JavaFileObject source = JavaFileObjects.forSourceLines( "io.qameta.allure.description.test.DescriptionSample", "package io.qameta.allure.description.test;", "import io.qameta.allure.Description;", @@ -78,19 +114,16 @@ void skipUncommentedMethodTest() { "}" ); - Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()); - Compilation compilation = compiler.compile(source); + final Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()); + final Compilation compilation = compiler.compile(source); assertThat(compilation).succeeded(); - assertThat(compilation) - .hadWarningContaining("Unable to create resource for method " - + "sampleTestWithoutJavadocComment[] as it does not have a docs comment"); } @Test void captureDescriptionParametrizedTestWithGenericParameterTest() { final String expectedMethodSignatureHash = "e90e26691bf14511db819d78624ba716"; - JavaFileObject source = JavaFileObjects.forSourceLines( + final JavaFileObject source = JavaFileObjects.forSourceLines( "io.qameta.allure.description.test.DescriptionSample", "package io.qameta.allure.description.test;", "import io.qameta.allure.Description;", @@ -117,12 +150,12 @@ void captureDescriptionParametrizedTestWithGenericParameterTest() { "}" ); - Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()); - Compilation compilation = compiler.compile(source); + final Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()); + final Compilation compilation = compiler.compile(source); assertThat(compilation).generatedFile( StandardLocation.CLASS_OUTPUT, - ALLURE_PACKAGE_NAME, - expectedMethodSignatureHash + "", + ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash ); } @@ -130,7 +163,7 @@ void captureDescriptionParametrizedTestWithGenericParameterTest() { void captureDescriptionParametrizedTestWithPrimitivesParameterTest() { final String expectedMethodSignatureHash = "edeeeaa02f01218cc206e0c6ff024c7a"; - JavaFileObject source = JavaFileObjects.forSourceLines( + final JavaFileObject source = JavaFileObjects.forSourceLines( "io.qameta.allure.description.test.DescriptionSample", "package io.qameta.allure.description.test;", "import io.qameta.allure.Description;", @@ -150,12 +183,15 @@ void captureDescriptionParametrizedTestWithPrimitivesParameterTest() { "}" ); - Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()); - Compilation compilation = compiler.compile(source); - assertThat(compilation).generatedFile( - StandardLocation.CLASS_OUTPUT, - ALLURE_PACKAGE_NAME, - expectedMethodSignatureHash - ); + final Compiler compiler = javac().withProcessors(new JavaDocDescriptionsProcessor()); + final Compilation compilation = compiler.compile(source); + assertThat(compilation) + .generatedFile( + StandardLocation.CLASS_OUTPUT, + "", + ALLURE_DESCRIPTIONS_FOLDER + expectedMethodSignatureHash + ) + .contentsAsUtf8String() + .isEqualTo("Captured javadoc description"); } } diff --git a/allure-grpc/build.gradle.kts b/allure-grpc/build.gradle.kts index fa09af0d7..1205a6caf 100644 --- a/allure-grpc/build.gradle.kts +++ b/allure-grpc/build.gradle.kts @@ -8,7 +8,7 @@ description = "Allure gRPC Integration" val agent: Configuration by configurations.creating -val grpcVersion = "1.57.1" +val grpcVersion = "1.57.2" val protobufVersion = "3.22.4" dependencies { diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Description.java b/allure-java-commons/src/main/java/io/qameta/allure/Description.java index c02c4405e..7ee351433 100644 --- a/allure-java-commons/src/main/java/io/qameta/allure/Description.java +++ b/allure-java-commons/src/main/java/io/qameta/allure/Description.java @@ -21,7 +21,7 @@ import java.lang.annotation.Target; /** - * Annotation that allows to attach a description for a test. + * Annotation that allows to attach a description for a test. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -39,7 +39,9 @@ * supports html markdown. * * @return boolean flag to enable description extraction from javadoc. + * @deprecated use {@link Description} without value specified instead. */ + @Deprecated boolean useJavaDoc() default false; } diff --git a/allure-java-commons/src/main/java/io/qameta/allure/util/ResultsUtils.java b/allure-java-commons/src/main/java/io/qameta/allure/util/ResultsUtils.java index 4893dd4d5..aa86319d2 100644 --- a/allure-java-commons/src/main/java/io/qameta/allure/util/ResultsUtils.java +++ b/allure-java-commons/src/main/java/io/qameta/allure/util/ResultsUtils.java @@ -97,7 +97,7 @@ public final class ResultsUtils { public static final String LANGUAGE_LABEL_NAME = "language"; private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtils.class); - private static final String ALLURE_DESCRIPTIONS_PACKAGE = "allureDescriptions/"; + private static final String ALLURE_DESCRIPTIONS_FOLDER = "META-INF/allureDescriptions/"; private static final String MD_5 = "MD5"; private static String cachedHost; @@ -305,7 +305,7 @@ public static Optional getJavadocDescription(final ClassLoader classLoad name, parameterTypes); - return readResource(classLoader, ALLURE_DESCRIPTIONS_PACKAGE + signatureHash) + return readResource(classLoader, ALLURE_DESCRIPTIONS_FOLDER + signatureHash) .map(desc -> separateLines() ? desc.replace("\n", "
") : desc); } @@ -389,11 +389,12 @@ public static void processDescription(final ClassLoader classLoader, final Consumer setDescription, final Consumer setDescriptionHtml) { if (method.isAnnotationPresent(Description.class)) { - if (method.getAnnotation(Description.class).useJavaDoc()) { + final Description annotation = method.getAnnotation(Description.class); + if ("".equals(annotation.value())) { getJavadocDescription(classLoader, method) .ifPresent(setDescriptionHtml); } else { - final String description = method.getAnnotation(Description.class).value(); + final String description = annotation.value(); setDescription.accept(description); } } diff --git a/allure-junit4/build.gradle.kts b/allure-junit4/build.gradle.kts index 9597c6391..d8117ef55 100644 --- a/allure-junit4/build.gradle.kts +++ b/allure-junit4/build.gradle.kts @@ -6,6 +6,7 @@ dependencies { api(project(":allure-java-commons")) implementation("junit:junit:$junitVersion") implementation(project(":allure-test-filter")) + testAnnotationProcessor(project(":allure-descriptions-javadoc")) testImplementation("org.assertj:assertj-core") testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("org.mockito:mockito-core") diff --git a/allure-junit4/src/main/java/io/qameta/allure/junit4/AllureJunit4.java b/allure-junit4/src/main/java/io/qameta/allure/junit4/AllureJunit4.java index 72589a82b..8cf402579 100644 --- a/allure-junit4/src/main/java/io/qameta/allure/junit4/AllureJunit4.java +++ b/allure-junit4/src/main/java/io/qameta/allure/junit4/AllureJunit4.java @@ -29,12 +29,15 @@ import org.junit.runner.notification.Failure; import org.junit.runner.notification.RunListener; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.UUID; +import java.util.stream.Collectors; +import java.util.stream.Stream; import static io.qameta.allure.util.AnnotationUtils.getLabels; import static io.qameta.allure.util.AnnotationUtils.getLinks; @@ -46,6 +49,7 @@ import static io.qameta.allure.util.ResultsUtils.createTestClassLabel; import static io.qameta.allure.util.ResultsUtils.createTestMethodLabel; import static io.qameta.allure.util.ResultsUtils.createThreadLabel; +import static io.qameta.allure.util.ResultsUtils.getJavadocDescription; import static io.qameta.allure.util.ResultsUtils.getProvidedLabels; import static io.qameta.allure.util.ResultsUtils.getStatus; import static io.qameta.allure.util.ResultsUtils.getStatusDetails; @@ -176,9 +180,40 @@ private Optional getDisplayName(final Description result) { .map(DisplayName::value); } + @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") private Optional getDescription(final Description result) { - return Optional.ofNullable(result.getAnnotation(io.qameta.allure.Description.class)) - .map(io.qameta.allure.Description::value); + final io.qameta.allure.Description annotation = result + .getAnnotation(io.qameta.allure.Description.class); + + if (Objects.isNull(annotation)) { + return Optional.empty(); + } + + if (!"".equals(annotation.value())) { + return Optional.of(annotation.value()); + } + + // since we have no access to method & method parameter types + // we simply find all the methods within test class that matching + // specified method name. If there is only one result, consider it a + // test. + final Class testClass = result.getTestClass(); + final String methodName = result.getMethodName(); + if (Objects.nonNull(testClass) && Objects.nonNull(methodName)) { + final List found = Stream.of(testClass.getMethods()) + .filter(method -> Objects.equals(methodName, method.getName())) + .collect(Collectors.toList()); + if (found.size() != 1) { + return Optional.empty(); + } + + final Method method = found.get(0); + return getJavadocDescription( + method.getDeclaringClass().getClassLoader(), + method + ); + } + return Optional.empty(); } private List extractLinks(final Description description) { @@ -247,6 +282,7 @@ private TestResult createTestResult(final String uuid, final Description descrip testResult.getLinks().addAll(extractLinks(description)); getDisplayName(description).ifPresent(testResult::setName); + getDescription(description).ifPresent(testResult::setDescription); return testResult; } diff --git a/allure-junit4/src/test/java/io/qameta/allure/junit4/AllureJunit4Test.java b/allure-junit4/src/test/java/io/qameta/allure/junit4/AllureJunit4Test.java index 2d1d29a51..7da9aba36 100644 --- a/allure-junit4/src/test/java/io/qameta/allure/junit4/AllureJunit4Test.java +++ b/allure-junit4/src/test/java/io/qameta/allure/junit4/AllureJunit4Test.java @@ -23,6 +23,7 @@ import io.qameta.allure.junit4.samples.AssumptionFailedTest; import io.qameta.allure.junit4.samples.BrokenTest; import io.qameta.allure.junit4.samples.BrokenWithoutMessageTest; +import io.qameta.allure.junit4.samples.DescriptionsJavadoc; import io.qameta.allure.junit4.samples.FailedTest; import io.qameta.allure.junit4.samples.FilterSimpleTests; import io.qameta.allure.junit4.samples.IgnoredClassTest; @@ -33,6 +34,7 @@ import io.qameta.allure.junit4.samples.TestWithAnnotations; import io.qameta.allure.junit4.samples.TestWithSteps; import io.qameta.allure.junit4.samples.TestWithTimeout; +import io.qameta.allure.junit4.samples.TheoriesTest; import io.qameta.allure.model.Label; import io.qameta.allure.model.Link; import io.qameta.allure.model.Stage; @@ -387,6 +389,32 @@ void shouldFilterByAllureId() { .containsExactly("io.qameta.allure.junit4.samples.FilterSimpleTests.test3"); } + @Test + void shouldProcessJavadocDescriptions() { + final AllureResults results = runClasses(DescriptionsJavadoc.class); + + final List testResults = results.getTestResults(); + + assertThat(testResults) + .extracting(TestResult::getName, TestResult::getDescription) + .containsExactlyInAnyOrder( + tuple("simpleTest", "Description from javadoc.") + ); + } + + @Test + void shouldProcessJavadocDescriptionsInTheories() { + final AllureResults results = runClasses(TheoriesTest.class); + + final List testResults = results.getTestResults(); + + assertThat(testResults) + .extracting(TestResult::getName, TestResult::getDescription) + .containsExactlyInAnyOrder( + tuple("simpleTest", "Description from javadoc.") + ); + } + @Step("Run classes {classes}") private AllureResults runClasses(final Class... classes) { return runClasses(null, classes); diff --git a/allure-junit4/src/test/java/io/qameta/allure/junit4/samples/DescriptionsJavadoc.java b/allure-junit4/src/test/java/io/qameta/allure/junit4/samples/DescriptionsJavadoc.java new file mode 100644 index 000000000..467f4c513 --- /dev/null +++ b/allure-junit4/src/test/java/io/qameta/allure/junit4/samples/DescriptionsJavadoc.java @@ -0,0 +1,33 @@ +/* + * Copyright 2023 Qameta Software OÜ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.qameta.allure.junit4.samples; + +import io.qameta.allure.Description; +import org.junit.Test; + +/** + * @author charlie (Dmitry Baev). + */ +public class DescriptionsJavadoc { + + /** + * Description from javadoc. + */ + @Description + @Test + public void simpleTest() { + } +} diff --git a/allure-junit4/src/test/java/io/qameta/allure/junit4/samples/TheoriesTest.java b/allure-junit4/src/test/java/io/qameta/allure/junit4/samples/TheoriesTest.java new file mode 100644 index 000000000..22768d2b6 --- /dev/null +++ b/allure-junit4/src/test/java/io/qameta/allure/junit4/samples/TheoriesTest.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Qameta Software OÜ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.qameta.allure.junit4.samples; + +import io.qameta.allure.Description; +import org.junit.experimental.theories.DataPoints; +import org.junit.experimental.theories.Theories; +import org.junit.experimental.theories.Theory; +import org.junit.runner.RunWith; + +/** + * @author charlie (Dmitry Baev). + */ +@RunWith(Theories.class) +public class TheoriesTest { + + @DataPoints + public static final String[] VALUES = new String[]{ + "first", + "second" + }; + + /** + * Description from javadoc. + */ + @Description + @Theory + public void simpleTest(final String value) { + System.out.println(value); + } +} diff --git a/allure-rest-assured/build.gradle.kts b/allure-rest-assured/build.gradle.kts index d2b534b18..ba734a063 100644 --- a/allure-rest-assured/build.gradle.kts +++ b/allure-rest-assured/build.gradle.kts @@ -1,6 +1,6 @@ description = "Allure Rest-Assured Integration" -val restAssuredVersion = "5.1.1" +val restAssuredVersion = "5.3.1" dependencies { api(project(":allure-attachments")) diff --git a/allure-selenide/build.gradle.kts b/allure-selenide/build.gradle.kts index 641605ec6..39ca99aa1 100644 --- a/allure-selenide/build.gradle.kts +++ b/allure-selenide/build.gradle.kts @@ -1,6 +1,6 @@ description = "Allure Selenide Integration" -val selenideVersion = "6.11.2" +val selenideVersion = "6.17.1" dependencies { api(project(":allure-java-commons")) diff --git a/allure-spock2/src/main/java/io/qameta/allure/spock2/AllureSpock2.java b/allure-spock2/src/main/java/io/qameta/allure/spock2/AllureSpock2.java index c7be6decc..9c973b7de 100644 --- a/allure-spock2/src/main/java/io/qameta/allure/spock2/AllureSpock2.java +++ b/allure-spock2/src/main/java/io/qameta/allure/spock2/AllureSpock2.java @@ -42,6 +42,7 @@ import org.spockframework.runtime.model.MethodInfo; import org.spockframework.runtime.model.MethodKind; import org.spockframework.runtime.model.SpecInfo; +import org.spockframework.runtime.model.TestTag; import java.lang.reflect.Method; import java.security.MessageDigest; @@ -185,6 +186,12 @@ public void beforeIteration(final IterationInfo iteration) { labels.add(createParentSuiteLabel(superSpec.getName())); } + final List