Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'

- name: Cache Maven dependencies
Expand All @@ -31,7 +31,7 @@ jobs:
echo "This ensures all internal dependencies are available locally before testing"

# Module build order (based on dependencies)
MODULES=("java-reporter-core" "java-reporter-junit" "java-reporter-testng" "java-reporter-cucumber")
MODULES=("java-reporter-core" "java-reporter-junit" "java-reporter-testng" "java-reporter-cucumber" "java-reporter-karate" "testomat-allure-adapter")

for module in "${MODULES[@]}"; do
if [ -d "$module" ]; then
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
run: |
echo "🧪 Running tests for all modules..."

MODULES=("java-reporter-core" "java-reporter-junit" "java-reporter-testng" "java-reporter-cucumber")
MODULES=("java-reporter-core" "java-reporter-junit" "java-reporter-testng" "java-reporter-cucumber" "java-reporter-karate" "testomat-allure-adapter")

for module in "${MODULES[@]}"; do
if [ -d "$module" ]; then
Expand Down
72 changes: 57 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ Artifacts are stored in external S3 buckets. S3 Access can be configured in **tw
|-------------------------------------|-----------------------------------------------------|-------------------------------------------|
| `testomatio.artifact.disable` | Completely disable artifact uploading | `false` |
| `testomatio.artifact.private` | Keep artifacts private (no public URLs) | `false` |
| `testomatio.artifact.sending.delay` | Wait time before uploading test artifacts | `10000 msec` |
| `testomatio.step.artifacts.enabled` | Enables uploading artifacts for test steps | `false` |
| `s3.force-path-style` | Use path-style URLs for S3-compatible storage | `false` |
| `s3.endpoint` | Custom endpoint to be used with force-path-style | `false` |
Expand Down Expand Up @@ -528,23 +529,64 @@ Steps provide granular visibility into test logic and help identify exactly wher

### Setup

Add AspectJ weaver to your test execution via maven-surefire-plugin:
Configure Compile-Time Weaving (CTW) with the AspectJ Maven Plugin:

maven
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.9.24/aspectjweaver-1.9.24.jar"
</argLine>
</configuration>
</plugin>
</plugins>
</build>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>

<plugin>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj.maven.version}</version>

<configuration>
<complianceLevel>${java.version}</complianceLevel>
<source>${java.version}</source>
<target>${java.version}</target>

<aspectLibraries>
<aspectLibrary>
<groupId>io.testomat</groupId>
<artifactId>java-reporter-core</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>

<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>

<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
```

gradle

```groovy
plugins {
id "io.freefair.aspectj" version "9.5.0"
}

dependencies {
implementation "org.aspectj:aspectjrt:1.9.24"
}
```

### Basic Usage
Expand Down
50 changes: 30 additions & 20 deletions java-reporter-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>io.testomat</groupId>
<artifactId>java-reporter-core</artifactId>
<version>0.16.1</version>
<version>0.17.0</version>
<packaging>jar</packaging>

<name>Testomat.io Reporter Core</name>
Expand All @@ -33,8 +33,8 @@
</developers>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand Down Expand Up @@ -72,9 +72,9 @@
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
<scope>compile</scope>
<artifactId>aspectjrt</artifactId>
<version>1.9.24</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand Down Expand Up @@ -144,14 +144,32 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14.1</version>

<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<complianceLevel>17</complianceLevel>
<source>17</source>
<target>17</target>
</configuration>

<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>

<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.24</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand All @@ -163,10 +181,6 @@
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
</includes>
<!-- required for tests-->
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
</plugin>

Expand Down Expand Up @@ -227,10 +241,6 @@
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<!-- Preserve AspectJ aop.xml for load-time weaving -->
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/aop.xml</resource>
</transformer>
</transformers>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.testomat.core.constants;

public class CommonConstants {
public static final String REPORTER_VERSION = "0.16.1";
public static final String REPORTER_VERSION = "0.17.0";

public static final String TESTS_STRING = "tests";
public static final String API_KEY_STRING = "api_key";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.testomat.core.facade.methods.artifact;

import io.testomat.core.facade.Testomatio;
import io.testomat.core.facade.ServiceRegistryUtil;
import io.testomat.core.facade.methods.artifact.manager.ArtifactManager;
import io.testomat.core.step.StepLifecycle;
import io.testomat.core.step.TestStep;
import java.io.File;
Expand All @@ -15,7 +16,7 @@ public class ArtifactAspect {
private static final Logger log = LoggerFactory.getLogger(ArtifactAspect.class);

@AfterReturning(
pointcut = "@annotation(io.testomat.core.annotation.Artifact)",
pointcut = "execution(* *(..)) && @annotation(io.testomat.core.annotation.Artifact)",
returning = "result"
)
public void afterArtifact(Object result) {
Expand All @@ -28,10 +29,11 @@ public void afterArtifact(Object result) {
if (testStep == null) {
testStep = StepLifecycle.lastFinished();
}
ArtifactManager artifactManager = ServiceRegistryUtil.getService(ArtifactManager.class);
if (testStep == null || testStep.getId() == null) {
Testomatio.artifact(fileName);
artifactManager.storeDirectories(fileName);
} else {
Testomatio.stepArtifact(fileName);
artifactManager.storeStepDirectories(testStep.getId(), fileName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,20 +360,20 @@ private boolean isReportingDisabled() {
/**
* Returns the delay before sending artifacts in milliseconds.
*
* <p>Reads the value from the {@code artifacts.sending.delay} system property.
* <p>Reads the value from the {@code testomatio.artifact.sending.delay} system property.
* If the property is missing, non-numeric, or not positive, a default value is used.</p>
*/
private static int getDelayBeforeArtifactsSendingMs() {
int defaultDelayMs = 10000;
String value = System.getProperty("artifacts.sending.delay");
String value = System.getProperty("testomatio.artifact.sending.delay");
if (value == null) {
return defaultDelayMs;
}
try {
int delayMs = Integer.parseInt(value.trim());
return delayMs > 0 ? delayMs : defaultDelayMs;
} catch (NumberFormatException nfe) {
log.warn("Invalid artifacts.sending.delay value: {}, using default {}", value, defaultDelayMs);
log.warn("Invalid testomatio.artifact.sending.delay value: {}, using default {}", value, defaultDelayMs);
return defaultDelayMs;
}
}
Expand Down
6 changes: 6 additions & 0 deletions java-reporter-core/src/main/resources/META-INF/aop-ajc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<aspectj>
<aspects>
<aspect name="io.testomat.core.step.StepAspect"/>
<aspect name="io.testomat.core.facade.methods.artifact.ArtifactAspect"/>
</aspects>
</aspectj>
10 changes: 2 additions & 8 deletions java-reporter-core/src/main/resources/META-INF/aop.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "https://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<aspects>
<aspect name="io.testomat.core.step.StepAspect"/>
<aspect name="io.testomat.core.facade.methods.artifact.ArtifactAspect"/>
</aspects>

<weaver>
<!-- Weave all user classes -->
<include within="*"/>
<exclude within="io.testomat.core.step.StepAspect"/>
<exclude within="io.testomat.core.facade.methods.artifact.ArtifactAspect"/>
</weaver>
</aspectj>
Loading
Loading