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
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | ✅ | ✅ | ✅ | ✅ |
Expand All @@ -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+ |

Expand All @@ -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_`)
Expand Down Expand Up @@ -255,37 +254,37 @@ Feature: User Authentication
```

### For Karate

Test ID format: ```@T + 8 alphanumeric characters.```
```gherkin
Feature: Posts API

Background:
* 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 <TestId>
@Title:Validate_post_titles @Tpost0004
Scenario Outline: Validate post titles
Given path 'posts', <id>
When method get
Then eval assertStatus.checkStatusCode(responseStatus, 200)
Expand All @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion 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.9.1</version>
<version>0.9.2</version>
<packaging>jar</packaging>

<name>Testomat.io Reporter Core</name>
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.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";
Expand Down
2 changes: 1 addition & 1 deletion java-reporter-cucumber/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>io.testomat</groupId>
<artifactId>java-reporter-core</artifactId>
<version>0.9.1</version>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
2 changes: 1 addition & 1 deletion java-reporter-junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>io.testomat</groupId>
<artifactId>java-reporter-core</artifactId>
<version>0.9.1</version>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
4 changes: 2 additions & 2 deletions java-reporter-karate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.testomat</groupId>
<artifactId>java-reporter-karate</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
<packaging>jar</packaging>

<name>Testomat.io Java Reporter Karate</name>
Expand Down Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>io.testomat</groupId>
<artifactId>java-reporter-core</artifactId>
<version>0.9.1</version>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>io.karatelabs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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:";

Expand All @@ -46,19 +44,18 @@ public ExceptionDetails extractExceptionDetails(ScenarioRuntime sr) {
/**
* Extracts a test identifier from scenario tags.
* <p>
* 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);
}

/**
Expand Down Expand Up @@ -161,13 +158,6 @@ public String getRid(ScenarioRuntime sr) {
return UUID.nameUUIDFromBytes(raw.getBytes()).toString();
}

private String findFirstValidTestId(Stream<String> 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);
Expand Down
2 changes: 1 addition & 1 deletion java-reporter-testng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>io.testomat</groupId>
<artifactId>java-reporter-core</artifactId>
<version>0.9.1</version>
<version>0.9.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.testomat</groupId>
<artifactId>java-reporter</artifactId>
<version>0.2.0</version>
<version>0.2.1</version>
<packaging>pom</packaging>

<name>Testomat.io Java Reporter</name>
Expand Down
Loading