diff --git a/README.md b/README.md index 88d0d40..ace35f0 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ and team collaboration features. | **Shared run** | Collaborative test execution sharing | ✅ | ✅ | ✅ | ✅ | | **Test runs grouping** | Organize and categorize test executions | ✅ | ✅ | ✅ | ✅ | | **Public sharable link** | Generate public URLs for test run results | ✅ | ✅ | ✅ | ✅ | -| **Test code export** | Export test code from codebase to platform | ✅ | ✅ | ✅ | ⏳ | +| **Test code export** | Export test code from codebase to platform | ✅ | ✅ | ✅ | ✅ | | **Advanced error reporting** | Detailed test failure/skip descriptions | ✅ | ✅ | ✅ | ✅ | -| **TestId import** | Import test IDs from testomat.io into the codebase | ✅ | ✅ | ✅ | ⏳ | +| **TestId import** | Import test IDs from testomat.io into the codebase | ✅ | ✅ | ✅ | ✅ | | **Test filter by ID** | Run tests filtered by IDs | ✅ | ✅ | ✅ | ✅ | | **Parametrized tests support** | Enhanced support for parameterized testing | ✅ | ✅ | ✅ | ✅ | | **Test artifacts support** | Screenshots, logs, and file attachments | ✅ | ✅ | ✅ | ✅ | @@ -37,7 +37,6 @@ and team collaboration features. | What you need | Version | We tested with | Supported java version | |---------------|:-------:|:--------------:|:----------------------:| | **JUnit** | 5.x | 5.9.2 | Java 11+ | -| **TestNG** | 7.x | 7.7.1 | Java 11+ | | **Cucumber** | 7.x | 7.14.0 | Java 11+ | | **Karate** | 1.x | 1.5.0 | Java 17+ | @@ -48,7 +47,7 @@ and team collaboration features. 1. **Add the latest version** of the dependency to your POM.xml: [TestNG](https://central.sonatype.com/artifact/io.testomat/java-reporter-testng) [JUnit](https://central.sonatype.com/artifact/io.testomat/java-reporter-junit) - [Cucumber](https://central.sonatype.com/artifact/io.testomat/java-reporter-cucumber) + [Cucumber](https://central.sonatype.com/artifact/io.testomat/java-reporter-cucumber) [Karate](https://central.sonatype.com/artifact/io.testomat/java-reporter-karate) 2. **Get your API key** from [Testomat.io](https://app.testomat.io/) (starts with `tstmt_`) @@ -255,7 +254,7 @@ Feature: User Authentication ``` ### For Karate - +Test ID format: ```@T + 8 alphanumeric characters.``` ```gherkin Feature: Posts API @@ -263,29 +262,29 @@ Feature: Posts API * url 'https://jsonplaceholder.typicode.com' * def assertStatus = Java.type('helpers.AssertStatus') - @Title:Get_all_posts @TestId:Tpost0001 @Attachments:logs/karate.log + @Title:Get_all_posts @Tpost0001 @Attachments:logs/karate.log Scenario: Get all posts Given path 'posts' When method get Then eval assertStatus.checkStatusCode(responseStatus, 200) And match response[0].id != null - @Title:Get_single_post @TestId:Tpost0002 + @Title:Get_single_post @Tpost0002 Scenario: Get single post Given path 'posts', 1 When method get Then eval assertStatus.checkStatusCode(responseStatus, 200) And match response.id == 1 - @Title:Get_comments_for_post @TestId:Tpost0003 + @Title:Get_comments_for_post @Tpost0003 Scenario: Get comments for post Given path 'posts', 1, 'comments' When method get Then eval assertStatus.checkStatusCode(responseStatus, 200) And match response[0].postId == 1 - @Title:Validate_post_titles @TestId:Tpost0004 - Scenario Outline: Validate post titles + @Title:Validate_post_titles @Tpost0004 + Scenario Outline: Validate post titles Given path 'posts', When method get Then eval assertStatus.checkStatusCode(responseStatus, 200) @@ -297,7 +296,7 @@ Feature: Posts API | 2 | | 3 | - @Title:Create_post @TestId:Tpost0005 + @Title:Create_post @Tpost0005 Scenario: Create post Given path 'posts' And request { title: 'foo', body: 'bar', userId: 1 } diff --git a/java-reporter-core/pom.xml b/java-reporter-core/pom.xml index 22c42b1..582e396 100644 --- a/java-reporter-core/pom.xml +++ b/java-reporter-core/pom.xml @@ -7,7 +7,7 @@ io.testomat java-reporter-core - 0.9.1 + 0.9.2 jar Testomat.io Reporter Core diff --git a/java-reporter-core/src/main/java/io/testomat/core/constants/CommonConstants.java b/java-reporter-core/src/main/java/io/testomat/core/constants/CommonConstants.java index 90c0529..f0a1768 100644 --- a/java-reporter-core/src/main/java/io/testomat/core/constants/CommonConstants.java +++ b/java-reporter-core/src/main/java/io/testomat/core/constants/CommonConstants.java @@ -1,7 +1,7 @@ package io.testomat.core.constants; public class CommonConstants { - public static final String REPORTER_VERSION = "0.9.1"; + public static final String REPORTER_VERSION = "0.9.2"; public static final String TESTS_STRING = "tests"; public static final String API_KEY_STRING = "api_key"; diff --git a/java-reporter-cucumber/pom.xml b/java-reporter-cucumber/pom.xml index 253b701..70b214f 100644 --- a/java-reporter-cucumber/pom.xml +++ b/java-reporter-cucumber/pom.xml @@ -51,7 +51,7 @@ io.testomat java-reporter-core - 0.9.1 + 0.9.2 org.slf4j diff --git a/java-reporter-junit/pom.xml b/java-reporter-junit/pom.xml index 206fd41..1ed0342 100644 --- a/java-reporter-junit/pom.xml +++ b/java-reporter-junit/pom.xml @@ -51,7 +51,7 @@ io.testomat java-reporter-core - 0.9.1 + 0.9.2 org.slf4j diff --git a/java-reporter-karate/pom.xml b/java-reporter-karate/pom.xml index 0051c50..133eec4 100644 --- a/java-reporter-karate/pom.xml +++ b/java-reporter-karate/pom.xml @@ -6,7 +6,7 @@ io.testomat java-reporter-karate - 0.2.3 + 0.2.4 jar Testomat.io Java Reporter Karate @@ -52,7 +52,7 @@ io.testomat java-reporter-core - 0.9.1 + 0.9.2 io.karatelabs diff --git a/java-reporter-karate/src/main/java/io/testomat/karate/constructor/KarateTestResultConstructor.java b/java-reporter-karate/src/main/java/io/testomat/karate/constructor/KarateTestResultConstructor.java index 5a115a3..e977e7e 100644 --- a/java-reporter-karate/src/main/java/io/testomat/karate/constructor/KarateTestResultConstructor.java +++ b/java-reporter-karate/src/main/java/io/testomat/karate/constructor/KarateTestResultConstructor.java @@ -57,7 +57,8 @@ public TestResult constructTestRunResult(ScenarioRuntime sr) { .withTitle(testDataExtractor.extractTitle(sr)) .withRid(testDataExtractor.getRid(sr)) .withMessage(exceptionDetails.getMessage()) - .withStack(exceptionDetails.getStack()); + .withStack(exceptionDetails.getStack()) + .withOverwrite(false); if (!steps.isEmpty()) { builder.withSteps(steps); diff --git a/java-reporter-karate/src/main/java/io/testomat/karate/extractor/TestDataExtractor.java b/java-reporter-karate/src/main/java/io/testomat/karate/extractor/TestDataExtractor.java index eb11466..2deb2ff 100644 --- a/java-reporter-karate/src/main/java/io/testomat/karate/extractor/TestDataExtractor.java +++ b/java-reporter-karate/src/main/java/io/testomat/karate/extractor/TestDataExtractor.java @@ -13,7 +13,6 @@ import java.util.Arrays; import java.util.Objects; import java.util.UUID; -import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +25,6 @@ public class TestDataExtractor { private static final Logger log = LoggerFactory.getLogger(TestDataExtractor.class); private static final String TEST_ID_REGEX = "T[a-z0-9]{8}"; - private static final String TEST_ID_PREFIX = "testid"; private static final String TITLE_PREFIX = "title:"; private static final String ATTACHMENTS_PREFIX = "attachments:"; @@ -46,19 +44,18 @@ public ExceptionDetails extractExceptionDetails(ScenarioRuntime sr) { /** * Extracts a test identifier from scenario tags. *

- * Searches for the first tag that starts with the configured {@code TEST_ID_PREFIX} - * (case-insensitive), removes the prefix, and validates the remaining value. + * Searches for the first tag that starts with the configured {@code TEST_ID_REGEX} * * @param sr the {@link ScenarioRuntime} of the executed Karate scenario * @return the extracted test identifier, or {@code null} if none is found */ public String extractTestId(ScenarioRuntime sr) { - return findFirstValidTestId(sr.tags.getTags().stream() + return sr.tags.getTags().stream() .filter(Objects::nonNull) - .filter(tag -> tag.regionMatches(true, 0, - TEST_ID_PREFIX, 0, TEST_ID_PREFIX.length())) - .map(tag -> tag.substring(TEST_ID_PREFIX.length() + 1))); - + .filter(id -> id.matches(TEST_ID_REGEX)) + .map(id -> "@" + id) + .findFirst() + .orElse(null); } /** @@ -161,13 +158,6 @@ public String getRid(ScenarioRuntime sr) { return UUID.nameUUIDFromBytes(raw.getBytes()).toString(); } - private String findFirstValidTestId(Stream ids) { - return ids - .filter(id -> id.matches(TEST_ID_REGEX)) - .findFirst() - .orElse(null); - } - private ExceptionDetails createExceptionDetails(Throwable throwable) { String message = throwable.getMessage(); String stack = getStackTrace(throwable); diff --git a/java-reporter-testng/pom.xml b/java-reporter-testng/pom.xml index 9204f4a..6221211 100644 --- a/java-reporter-testng/pom.xml +++ b/java-reporter-testng/pom.xml @@ -47,7 +47,7 @@ io.testomat java-reporter-core - 0.9.1 + 0.9.2 org.slf4j diff --git a/pom.xml b/pom.xml index 45e6c1e..f7754c3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.testomat java-reporter - 0.2.0 + 0.2.1 pom Testomat.io Java Reporter