Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Allure HTML reporting for testing #122

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
kornys marked this conversation as resolved.
Show resolved Hide resolved
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.
75 changes: 75 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
<commons.io.version>2.15.1</commons.io.version>
<jsr305.version>3.0.2</jsr305.version>
<docs.generator.version>0.0.4-SNAPSHOT</docs.generator.version>
<aspectj.version>1.9.21.2</aspectj.version>
<allure.version>2.25.0</allure.version>
<allure.maven.version>2.12.0</allure.maven.version>
</properties>

<repositories>
Expand All @@ -77,6 +80,18 @@
</pluginRepository>
</pluginRepositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-bom</artifactId>
<version>${allure.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
Expand Down Expand Up @@ -189,6 +204,11 @@
<artifactId>test-docs-generator-maven-plugin</artifactId>
<version>${docs.generator.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-java-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -338,6 +358,14 @@
<generateFmf>false</generateFmf>
</configuration>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>${allure.maven.version}</version>
<configuration>
<reportVersion>${allure.version}</reportVersion>
</configuration>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -426,6 +454,53 @@
</groups>
</properties>
</profile>

<profile>
<id>allure</id>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5-assert</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-hamcrest</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-okhttp3</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
3 changes: 3 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@

<logger name="io.fabric8.kubernetes.client" level="OFF"/>

<!-- processing of hamcrest assertions outputs useless ERROR messages -->
<logger name="io.qameta.allure.AllureLifecycle" level="OFF"/>

</configuration>
10 changes: 7 additions & 3 deletions src/test/java/io/odh/test/e2e/standard/PipelineServerST.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "[email protected]"),
Expand Down Expand Up @@ -252,6 +254,7 @@ void testUserCanCreateRunAndDeleteADSPipelineFromDSProject() throws IOException
}
}

@io.qameta.allure.Step
private void checkPipelineRunK8sDeployments(String prjTitle, String workflowName) {
List<List<Pod>> tektonTaskPods = Stream.of(
client.pods().inNamespace(prjTitle).withLabel("tekton.dev/taskRun=" + workflowName + "-data-prep"),
Expand All @@ -275,6 +278,7 @@ private void checkPipelineRunK8sDeployments(String prjTitle, String workflowName
}
}

@io.qameta.allure.Step
private static void waitForEndpoints(Resource<Endpoints> endpoints) {
TestUtils.waitFor("pipelines svc to come up", TestConstants.GLOBAL_POLL_INTERVAL_SHORT, TestConstants.GLOBAL_TIMEOUT, () -> {
try {
Expand Down
8 changes: 8 additions & 0 deletions src/test/resources/allure.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# 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/{}
kornys marked this conversation as resolved.
Show resolved Hide resolved
Loading