diff --git a/java-reporter-junit/README.md b/java-reporter-junit/README.md
index 5e6d712..264794a 100644
--- a/java-reporter-junit/README.md
+++ b/java-reporter-junit/README.md
@@ -1,4 +1,4 @@
-# Java reporter integration with JUnit5
+# Java reporter integration with JUnit
## Overview
@@ -14,7 +14,7 @@ This simple demo shows how Testomat.io Java reporter works in your project.
git clone https://github.com/testomatio/examples.git
```
2. Change the directory
-
+
```sh
cd java-reporter-junit
```
@@ -27,9 +27,11 @@ This simple demo shows how Testomat.io Java reporter works in your project.
## Configurations
-**By default, the library runs with properties default values except `testomatio.api.key` and `testomatio.listening`**
+**By default, the library runs with properties default values except `testomatio`**
+`testomatio` is the api key of the particular project on the [Testomat.io](https://app.testomat.io) platform.
+The reporting will be enabled automatically if the api key is provided.
+(you can also provide the key as JVM property `-Dtestomatio` or environment variable TESTOMATIO)
-
Add your project API key to the `testomatio.properties` file ad `testomatio.api.key`
@@ -44,8 +46,15 @@ Run tests with
where `tstmt_key` is your Testomat.io key from a particular project.
As a result, you will see a run report in your Project tab -> Runs on Testomat.io.
+
+
+As you can see, there is the `testomatio.artifact.disable=1` line in the `testomatio.properties` file.
+It disables the artifact handling by the reporter. Remove the value to enable or change it to "0".
+But for the reporter to handle the artifacts, you must add values to S3 related properties in the `testomatio.properties`
+file or provide them as JVM properties or ENV variables.
+But the most convenient way is to set these values on the [Testomat.io](https://beta.testomat.io) platform:
+
-
-
-
+After all that done remove value from `testomatio.artifact.disable` or remove it completely and run test including WebDriverArtifactTest class.
+
diff --git a/java-reporter-junit/img/artifact_run_result.png b/java-reporter-junit/img/artifact_run_result.png
new file mode 100644
index 0000000..173f794
Binary files /dev/null and b/java-reporter-junit/img/artifact_run_result.png differ
diff --git a/java-reporter-junit/img/artifact_settings_ui.png b/java-reporter-junit/img/artifact_settings_ui.png
new file mode 100644
index 0000000..cca4b8e
Binary files /dev/null and b/java-reporter-junit/img/artifact_settings_ui.png differ
diff --git a/java-reporter-junit/pom.xml b/java-reporter-junit/pom.xml
index ea46a11..8fe31ba 100644
--- a/java-reporter-junit/pom.xml
+++ b/java-reporter-junit/pom.xml
@@ -13,14 +13,15 @@
11UTF-85.9.2
-
+ 3.0.0-M9
+ 1.9.24io.testomatjava-reporter-junit
- 0.7.2
+ 0.8.14
@@ -35,21 +36,53 @@
${junit.version}test
+
+
+ org.seleniumhq.selenium
+ selenium-java
+ 4.15.0
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ 5.6.2
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.10.1
+
+ 11
+ 11
+ true
+
+
+
org.apache.maven.pluginsmaven-surefire-plugin
- 3.2.5
+ ${maven.surefire.version}
+
+ -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
+ **/*Test.java
+ methods
+ 4
+
+
+ junit.jupiter.execution.parallel.enabled=true
+ junit.jupiter.execution.parallel.mode.default=concurrent
+
+
-
\ No newline at end of file
diff --git a/java-reporter-junit/src/main/resources/testomatio.properties b/java-reporter-junit/src/main/resources/testomatio.properties
index 0e60611..049822b 100644
--- a/java-reporter-junit/src/main/resources/testomatio.properties
+++ b/java-reporter-junit/src/main/resources/testomatio.properties
@@ -1,11 +1,14 @@
-#Change to https://beta.testomat.io/ if you use it
-testomatio.url=https://app.testomat.io/
-
#define the run title, or it will be default_run_title
testomatio.run.title=junit-example-run
#Particular project api key, starts with "tstmt_"
-testomatio.api.key=
+testomatio=
+
+#Artifact related properties
+testomatio.artifact.disable=1
-#enables/disables the reporting (remove value to disable)
-testomatio.listening=true
\ No newline at end of file
+#S3 related properties
+s3.bucket=
+s3region=
+s3.access-key-id=
+s3.secret.access-key-id=
\ No newline at end of file
diff --git a/java-reporter-testng/.gitignore b/java-reporter-testng/.gitignore
new file mode 100644
index 0000000..7f0d307
--- /dev/null
+++ b/java-reporter-testng/.gitignore
@@ -0,0 +1,57 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+allure-results/
+
+.claude
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+**/logs/
+**/log/
+*.jar
+
+**/testomatio.properties
+
+### IntelliJ IDEA ###
+**/.idea/
+.idea
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/java-reporter-testng/README.md b/java-reporter-testng/README.md
index 2bfa468..50aebcf 100644
--- a/java-reporter-testng/README.md
+++ b/java-reporter-testng/README.md
@@ -27,9 +27,11 @@ This simple demo shows how Testomat.io Java reporter works in your project.
## Configurations
-**By default, the library runs with properties default values except `testomatio.api.key` and `testomatio.listening`**
+**By default, the library runs with properties default values except `testomatio`**
+`testomatio` is the api key of the particular project on the [Testomat.io](https://app.testomat.io) platform.
+The reporting will be enabled automatically if the api key is provided.
+(you can also provide the key as JVM property `-Dtestomatio` or environment variable TESTOMATIO)
-
Add your project API key to the `testomatio.properties` file ad `testomatio.api.key`
@@ -44,8 +46,15 @@ Run tests with
where `tstmt_key` is your Testomat.io key from a particular project.
As a result, you will see a run report in your Project tab -> Runs on Testomat.io.
+
-
-
-
+As you can see, there is the `testomatio.artifact.disable=1` line in the `testomatio.properties` file.
+It disables the artifact handling by the reporter. Remove the value to enable or change it to "0".
+But for the reporter to handle the artifacts, you must add values to S3 related properties in the `testomatio.properties`
+file or provide them as JVM properties or ENV variables.
+But the most convenient way is to set these values on the [Testomat.io](https://beta.testomat.io) platform:
+
+
+After all that done remove value from `testomatio.artifact.disable` or remove it completely and run test including WebDriverArtifactTest class.
+
diff --git a/java-reporter-testng/img/artifact_run_result.png b/java-reporter-testng/img/artifact_run_result.png
new file mode 100644
index 0000000..173f794
Binary files /dev/null and b/java-reporter-testng/img/artifact_run_result.png differ
diff --git a/java-reporter-testng/img/artifact_settings_ui.png b/java-reporter-testng/img/artifact_settings_ui.png
new file mode 100644
index 0000000..cca4b8e
Binary files /dev/null and b/java-reporter-testng/img/artifact_settings_ui.png differ
diff --git a/java-reporter-testng/pom.xml b/java-reporter-testng/pom.xml
index 5c7bb68..759a2d9 100644
--- a/java-reporter-testng/pom.xml
+++ b/java-reporter-testng/pom.xml
@@ -14,13 +14,15 @@
UTF-87.7.13.0.0-M9
+ 3.0.0-M9
+ 1.9.24io.testomatjava-reporter-testng
- 0.7.2
+ 0.8.14org.testng
@@ -28,18 +30,51 @@
${testng.version}test
+
+
+ org.seleniumhq.selenium
+ selenium-java
+ 4.15.0
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ 5.6.2
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.10.1
+
+ 11
+ 11
+ true
+
+
+
org.apache.maven.pluginsmaven-surefire-plugin${maven.surefire.version}
+
+ -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
+ **/*Test.java
+ methods
+ 4
+
+
+ junit.jupiter.execution.parallel.enabled=true
+ junit.jupiter.execution.parallel.mode.default=concurrent
+
+
diff --git a/java-reporter-testng/src/main/resources/testomatio.properties b/java-reporter-testng/src/main/resources/testomatio.properties
deleted file mode 100644
index 23fd259..0000000
--- a/java-reporter-testng/src/main/resources/testomatio.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-#Change to https://beta.testomat.io/ if you use it
-testomatio.url=https://app.testomat.io/
-
-#define the run title, or it will be default_run_title
-testomatio.run.title=testng-example-run
-
-#Particular project api key, starts with "tstmt_"
-testomatio.api.key=
-
-#enables/disables the reporting (remove value to disable)
-testomatio.listening=true
\ No newline at end of file
diff --git a/java-reporter-testng/src/test/java/com/library/StepExample.java b/java-reporter-testng/src/test/java/com/library/StepExample.java
new file mode 100644
index 0000000..7e1e1e6
--- /dev/null
+++ b/java-reporter-testng/src/test/java/com/library/StepExample.java
@@ -0,0 +1,81 @@
+package com.library;
+
+import io.testomat.core.annotation.Step;
+
+public class StepExample {
+
+ @Step
+ public static void print() {
+ System.out.println("STEP TEST");
+ }
+
+ @Step("Step example with no args substitution")
+ public static void stepExample() throws InterruptedException {
+ Thread.sleep(500);
+ System.out.println("Example step");
+ }
+
+ @Step("Args substitution. Arg1 = {a}, Arg2 = {b}")
+ public static int stepExample1(int a, int b) throws InterruptedException {
+ Thread.sleep(15000);
+ return 2+2;
+ }
+
+ @Step
+ public static String stepExample2() {
+ return "Random-" + System.currentTimeMillis();
+ }
+
+ @Step
+ public static void stepExample3() {
+ int result = 42 * 17 + 256;
+ System.out.println("Calculation result: " + result);
+ }
+
+ @Step
+ public static boolean stepExample4() throws InterruptedException {
+ Thread.sleep(300);
+ return Math.random() > 0.5;
+ }
+
+ @Step
+ public static void stepExample5() {
+ System.out.println("Logging test message at " + System.currentTimeMillis());
+ }
+
+ @Step
+ public static int stepExample6() {
+ return 7 * 13;
+ }
+
+ @Step
+ public static void stepExample7() throws InterruptedException {
+ Thread.sleep(1000);
+ System.out.println("Delay completed");
+ }
+
+ @Step
+ public static double stepExample8() {
+ return (75.0 / 100.0) * 200;
+ }
+
+ @Step
+ public static String stepExample9() {
+ return "Test" + "-" + "Method" + "-" + "Step";
+ }
+
+ @Step
+ public static void stepExample10() {
+ int[] numbers = {1, 2, 3, 4, 5};
+ for (int num : numbers) {
+ System.out.print(num + " ");
+ }
+ System.out.println();
+ }
+
+ @Step
+ public static boolean stepExample11() {
+ int randomNum = (int) (Math.random() * 100);
+ return randomNum % 2 == 0;
+ }
+}
diff --git a/java-reporter-testng/src/test/java/com/library/WebDriverArtifactTest.java b/java-reporter-testng/src/test/java/com/library/WebDriverArtifactTest.java
new file mode 100644
index 0000000..9a164b8
--- /dev/null
+++ b/java-reporter-testng/src/test/java/com/library/WebDriverArtifactTest.java
@@ -0,0 +1,184 @@
+package com.library;
+
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import io.github.bonigarcia.wdm.WebDriverManager;
+import io.testomat.core.annotation.TestId;
+import io.testomat.core.facade.Testomatio;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import org.openqa.selenium.By;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class WebDriverArtifactTest {
+
+ private WebDriver driver;
+
+ private String artifactDir;
+
+ @BeforeTest
+ void setUp() {
+ WebDriverManager.chromedriver().setup();
+ ChromeOptions options = new ChromeOptions();
+ options.addArguments("--headless");
+ options.addArguments("--no-sandbox");
+ options.addArguments("--disable-dev-shm-usage");
+ options.addArguments("--disable-gpu");
+ driver = new ChromeDriver(options);
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
+ artifactDir = "target/test-artifacts";
+ createArtifactDirectory();
+ }
+
+ @AfterTest
+ void tearDown() {
+ if (driver != null) {
+ driver.quit();
+ }
+ }
+
+ @Test
+ void shouldCreateArtifactsWithWebDriver() {
+ try {
+ driver.get("https://www.google.com");
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement searchBox = wait.until(ExpectedConditions.presenceOfElementLocated(By.name("q")));
+ assertNotNull(searchBox, "Search box should be present");
+ searchBox.sendKeys("Selenium WebDriver");
+ searchBox.submit();
+ Thread.sleep(2000);
+ String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
+ takeScreenshot("search_results_" + timestamp + ".png");
+ savePageSource("page_source_" + timestamp + ".html");
+ saveTestInfo("test_info1.txt");
+ String currentTitle = driver.getTitle();
+ String currentUrl = driver.getCurrentUrl();
+ assertTrue(currentUrl.contains("search"), "URL should contain search results");
+ Testomatio.artifact(artifactDir + "/test_info1.txt");
+ } catch (Exception e) {
+ fail("Test failed with exception: " + e.getMessage());
+ }
+ }
+
+ @Test
+ @TestId("063cdb82")
+ void shouldCreateArtifactsWithWebDriver1() {
+ try {
+ driver.get("https://www.google.com");
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement searchBox = wait.until(ExpectedConditions.presenceOfElementLocated(By.name("q")));
+ assertNotNull(searchBox, "Search box should be present");
+ searchBox.sendKeys("Selenium WebDriver");
+ searchBox.submit();
+ Thread.sleep(2000);
+ String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
+ takeScreenshot("search_results.png");
+ savePageSource("page_source_" + timestamp + ".html");
+ saveTestInfo("test_info2.txt");
+ String currentTitle = driver.getTitle();
+ String currentUrl = driver.getCurrentUrl();
+ assertTrue(currentUrl.contains("search"), "URL should contain search results");
+ Testomatio.artifact(artifactDir + "/test_info2.txt", artifactDir + "/search_results.png");
+ } catch (Exception e) {
+ fail("Test failed with exception: " + e.getMessage());
+ }
+ }
+
+ @Test
+ @TestId("b47df72e")
+ void shouldCreateArtifactsWithWebDriver2() {
+ try {
+ driver.get("https://www.google.com");
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement searchBox = wait.until(ExpectedConditions.presenceOfElementLocated(By.name("q")));
+ assertNotNull(searchBox, "Search box should be present");
+ searchBox.sendKeys("Selenium WebDriver");
+ searchBox.submit();
+ Thread.sleep(2000);
+ String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
+ takeScreenshot("search_results_" + timestamp + ".png");
+ savePageSource("page_source.html");
+ saveTestInfo("test_info.txt");
+ String currentTitle = driver.getTitle();
+ String currentUrl = driver.getCurrentUrl();
+ assertTrue(currentUrl.contains("search"), "URL should contain search results");
+ Testomatio.artifact(artifactDir + "/test_info.txt");
+ Testomatio.artifact(artifactDir + "/page_source.html");
+ StepExample.stepExample3();
+ } catch (Exception e) {
+ fail("Test failed with exception: " + e.getMessage());
+ }
+ }
+
+ private void createArtifactDirectory() {
+ try {
+ Path path = Paths.get(artifactDir);
+ if (!Files.exists(path)) {
+ Files.createDirectories(path);
+ }
+ } catch (IOException e) {
+ System.err.println("Failed to create artifact directory: " + e.getMessage());
+ }
+ }
+
+ private void takeScreenshot(String fileName) {
+ try {
+ TakesScreenshot screenshot = (TakesScreenshot) driver;
+ byte[] screenshotBytes = screenshot.getScreenshotAs(OutputType.BYTES);
+ Path screenshotPath = Paths.get(artifactDir, fileName);
+ Files.write(screenshotPath, screenshotBytes);
+ System.out.println("Screenshot saved: " + screenshotPath.toAbsolutePath());
+ } catch (IOException e) {
+ System.err.println("Failed to save screenshot: " + e.getMessage());
+ }
+ }
+
+ private void savePageSource(String fileName) {
+ try {
+ String pageSource = driver.getPageSource();
+ Path sourcePath = Paths.get(artifactDir, fileName);
+ Files.write(sourcePath, pageSource.getBytes());
+ System.out.println("Page source saved: " + sourcePath.toAbsolutePath());
+ } catch (IOException e) {
+ System.err.println("Failed to save page source: " + e.getMessage());
+ }
+ }
+
+ private void saveTestInfo(String fileName) {
+ try {
+ Path infoPath = Paths.get(artifactDir, fileName);
+ try (FileWriter writer = new FileWriter(infoPath.toFile())) {
+ writer.write("Test Execution Info\n");
+ writer.write("==================\n");
+ writer.write("Timestamp: " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "\n");
+ writer.write("URL: " + driver.getCurrentUrl() + "\n");
+ writer.write("Title: " + driver.getTitle() + "\n");
+ writer.write("Browser: " + ((ChromeDriver) driver).getCapabilities().getBrowserName() + "\n");
+ writer.write("Browser Version: " + ((ChromeDriver) driver).getCapabilities().getBrowserVersion() + "\n");
+ writer.write("Window Size: " + driver.manage().window().getSize() + "\n");
+ }
+ System.out.println("Test info saved: " + infoPath.toAbsolutePath());
+ } catch (IOException e) {
+ System.err.println("Failed to save test info: " + e.getMessage());
+ }
+ }
+}