From c0907fdc192977b7e759ce5e6e4bebad2810fdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Sat, 16 Mar 2024 22:39:51 +0100 Subject: [PATCH] Integrate Allure HTML reporting for testing Added Allure reporting dependencies and configuration for enhanced test result reporting. Updated code annotations for issue tracking, silenced internal Allure error logging during tests, and documented Allure report generation in README. --- README.md | 4 + pom.xml | 75 +++++++++++++++++++ src/main/resources/logback.xml | 3 + .../test/e2e/standard/PipelineServerST.java | 10 ++- src/test/resources/allure.properties | 9 +++ 5 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/allure.properties diff --git a/README.md b/README.md index afabe81f..3e52f237 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,7 @@ The docs are generated with every build and the changes should be committed when The plugin is still under development so the format could change. For more info see the plugin repository on GitHub. + +## Allure reports +Run `mvn test` with `-P allure` to collect testrun data, +then run `mvn allure:serve` to open a HTML report with the results in a web browser. diff --git a/pom.xml b/pom.xml index c7e1be22..679eb8b2 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,9 @@ 2.15.1 3.0.2 0.0.4-SNAPSHOT + 1.9.21.2 + 2.25.0 + 2.12.0 @@ -77,6 +80,18 @@ + + + + io.qameta.allure + allure-bom + ${allure.version} + pom + import + + + + io.fabric8 @@ -189,6 +204,11 @@ test-docs-generator-maven-plugin ${docs.generator.version} + + io.qameta.allure + allure-java-commons + test + @@ -338,6 +358,14 @@ false + + io.qameta.allure + allure-maven + ${allure.maven.version} + + ${allure.version} + + @@ -426,6 +454,53 @@ + + + allure + + + io.qameta.allure + allure-junit5 + runtime + + + io.qameta.allure + allure-junit5-assert + runtime + + + io.qameta.allure + allure-hamcrest + runtime + + + io.qameta.allure + allure-okhttp3 + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.version} + + + -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" + + + + + org.aspectj + aspectjweaver + ${aspectj.version} + runtime + + + + + + diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index a8aaf08d..07f5c021 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -27,4 +27,7 @@ + + + diff --git a/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java b/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java index 2cb49163..800d749b 100644 --- a/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java +++ b/src/test/java/io/odh/test/e2e/standard/PipelineServerST.java @@ -34,6 +34,8 @@ import io.opendatahub.datasciencepipelinesapplications.v1alpha1.DataSciencePipelinesApplicationBuilder; import io.opendatahub.datasciencepipelinesapplications.v1alpha1.datasciencepipelinesapplicationspec.ApiServer; import io.opendatahub.dscinitialization.v1.DSCInitialization; +import io.qameta.allure.Issue; +import io.qameta.allure.TmsLink; import io.skodjob.annotations.Contact; import io.skodjob.annotations.Desc; import io.skodjob.annotations.Step; @@ -93,9 +95,9 @@ void deployDataScienceCluster() { ResourceManager.getInstance().createResourceWithWait(dsc); } - /// ODS-2206 - Verify user can create and run a data science pipeline in DS Project - /// ODS-2226 - Verify user can delete components of data science pipeline from DS Pipelines page - /// https://issues.redhat.com/browse/RHODS-5133 + @Issue("RHODS-5133") + @TmsLink("ODS-2206") // Verify user can create and run a data science pipeline in DS Project + @TmsLink("ODS-2226") // Verify user can delete components of data science pipeline from DS Pipelines page @TestDoc( description = @Desc("Check that user can create, run and deleted DataSciencePipeline from a DataScience project"), contact = @Contact(name = "Jiri Danek", email = "jdanek@redhat.com"), @@ -252,6 +254,7 @@ void testUserCanCreateRunAndDeleteADSPipelineFromDSProject() throws IOException } } + @io.qameta.allure.Step private void checkPipelineRunK8sDeployments(String prjTitle, String workflowName) { List> tektonTaskPods = Stream.of( client.pods().inNamespace(prjTitle).withLabel("tekton.dev/taskRun=" + workflowName + "-data-prep"), @@ -275,6 +278,7 @@ private void checkPipelineRunK8sDeployments(String prjTitle, String workflowName } } + @io.qameta.allure.Step private static void waitForEndpoints(Resource endpoints) { TestUtils.waitFor("pipelines svc to come up", TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> { try { diff --git a/src/test/resources/allure.properties b/src/test/resources/allure.properties new file mode 100644 index 00000000..9806d18a --- /dev/null +++ b/src/test/resources/allure.properties @@ -0,0 +1,9 @@ +# +# Copyright Skodjob authors. +# License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). +# + +allure.results.directory=target/allure-results + +allure.link.issue.pattern = https://issues.redhat.com/browse/{} +allure.link.tms.pattern = https://polarion.engineering.redhat.com/polarion/#/project/OpenDataHub/workitem?id={}