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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Build with Gradle
run: ./gradlew build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ jobs:
version-file: ${{ env.VERSION_FILE }}
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}

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

- name: Setup git credentials
uses: oleksiyrudenko/gha-git-credentials@v2-latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [Unreleased]
### Changed
- Client version updated on [5.4.3](https://github.com/reportportal/client-java/releases/tag/5.4.3), by @HardNorth
- Replace "jsr305" annotations with "jakarta.annotation-api", by @HardNorth
- Switch on use of `Instant` class instead of `Date` to get more timestamp precision, by @HardNorth

## [5.3.2]
### Changed
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ project.ext.limits = [
'class' : 90
]

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

Expand All @@ -39,19 +39,19 @@ repositories {
}

dependencies {
api 'com.epam.reportportal:client-java:5.3.17'
api 'com.epam.reportportal:client-java:5.4.3'
api 'com.nordstrom.tools:junit-foundation:17.2.4'

implementation 'org.slf4j:slf4j-api:2.0.7'

testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.13'
testImplementation 'com.epam.reportportal:agent-java-test-utils:0.1.0'

testImplementation 'org.aspectj:aspectjweaver:1.9.19'
testImplementation 'org.hamcrest:hamcrest-core:2.2'
testImplementation "org.mockito:mockito-core:${project.mockito_version}"
testImplementation "org.mockito:mockito-junit-jupiter:${project.mockito_version}"
testImplementation 'ch.qos.logback:logback-classic:1.3.15'
testImplementation 'com.epam.reportportal:logger-java-logback:5.2.3'
testImplementation 'ch.qos.logback:logback-classic:1.5.18'
testImplementation 'com.epam.reportportal:logger-java-logback:5.4.0'
testImplementation ("org.junit.platform:junit-platform-runner:${project.junit5_runner_version}") {
exclude module: 'junit'
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=5.3.3-SNAPSHOT
version=5.4.0-SNAPSHOT
description=ReportPortal JUnit 4 client
junit5_version=5.6.3
junit5_runner_version=1.6.3
Expand Down
122 changes: 66 additions & 56 deletions src/main/java/com/epam/reportportal/junit/ReportPortalListener.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import com.epam.reportportal.service.tree.TestItemTree;
import com.epam.ta.reportportal.ws.model.ParameterResource;
import com.nordstrom.automation.junit.AtomicTest;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import org.junit.runner.Description;
import org.junit.runners.model.FrameworkMethod;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -70,7 +70,7 @@ public static TestItemTree.ItemTreeKey createItemTreeKey(@Nonnull AtomicTest tes
@Nonnull
public static TestItemTree.ItemTreeKey createItemTreeKey(@Nonnull Description description) {
String fullName = description.getTestClass().getName() + "." + description.getMethodName();
return TestItemTree.ItemTreeKey.of(fullName,fullName.hashCode());
return TestItemTree.ItemTreeKey.of(fullName, fullName.hashCode());
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ private static ItemAttributesRQ skippedIssue(Boolean skippedAnIssue) {
}

public static Set<ItemAttributesRQ> collectSystemAttributes(Boolean skippedAnIssue) {
Set<ItemAttributesRQ> systemAttributes = SystemAttributesExtractor.extract(PROPS_FILE,
Set<ItemAttributesRQ> systemAttributes = SystemAttributesExtractor.extract(
PROPS_FILE,
SystemAttributesFetcher.class.getClassLoader()
);
systemAttributes.add(skippedIssue(skippedAnIssue));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
import com.epam.reportportal.util.test.CommonUtils;
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;

import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.List;

import static com.epam.reportportal.junit.utils.TestUtils.PROCESSING_TIMEOUT;
Expand All @@ -42,14 +44,20 @@ public class CodeReferenceTest {
private final String methodId = CommonUtils.namedId("method_");

private final ReportPortalClient client = mock(ReportPortalClient.class);
private final ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, null, classId, methodId);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
public void verify_static_test_code_reference_generation() {
TestUtils.runClasses(CodeRefTest.class);
Expand Down
32 changes: 25 additions & 7 deletions src/test/java/com/epam/reportportal/junit/ItemTimeOrderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
import com.epam.reportportal.service.ReportPortal;
import com.epam.reportportal.service.ReportPortalClient;
import com.epam.reportportal.util.test.CommonUtils;
import com.epam.ta.reportportal.ws.model.ApiInfo;
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import io.reactivex.Maybe;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;

import java.util.Date;
import java.time.Instant;
import java.util.concurrent.ExecutorService;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand Down Expand Up @@ -56,15 +60,26 @@ public class ItemTimeOrderTest {
.collect(Collectors.toList());

private final ReportPortalClient client = mock(ReportPortalClient.class);
private final ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, firstSuiteId, secondSuiteId, classIds);
TestUtils.mockNestedSteps(client, tests);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ApiInfo info = new ApiInfo();
ApiInfo.Build build = new ApiInfo.Build();
info.setBuild(build);
build.setVersion("5.13.2");
when(client.getApiInfo()).thenReturn(Maybe.just(info));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
public void verify_test_hierarchy_on_suite_of_suites() {
TestUtils.runClasses(SuiteOfSuitesClass.class);
Expand All @@ -82,17 +97,20 @@ public void verify_test_hierarchy_on_suite_of_suites() {
verify(client, timeout(PROCESSING_TIMEOUT)).startTestItem(same(classIds.get(0)), stepCaptor.capture());
verify(client, timeout(PROCESSING_TIMEOUT)).startTestItem(same(classIds.get(1)), stepCaptor.capture());

Date previousDate = null;
Instant previousDate = null;
List<StartTestItemRQ> testItems = testCaptor.getAllValues();
List<StartTestItemRQ> suites = Stream.concat(suiteCaptor.getAllValues().stream(), testItems.stream()).collect(Collectors.toList());
for (StartTestItemRQ item : suites) {
Date parentDate = ofNullable(previousDate).orElseGet(() -> suites.get(0).getStartTime());
Date itemDate = item.getStartTime();
assertThat(item.getStartTime(), greaterThanOrEqualTo(parentDate));
Instant parentDate = ofNullable(previousDate).orElseGet(() -> (Instant) suites.get(0).getStartTime());
Instant itemDate = (Instant) item.getStartTime();
assertThat((Instant) item.getStartTime(), greaterThanOrEqualTo(parentDate));
previousDate = itemDate;
}
List<StartTestItemRQ> steps = stepCaptor.getAllValues();
IntStream.range(0, TEST_NUMBER)
.forEach(i -> assertThat(steps.get(i).getStartTime(), greaterThanOrEqualTo(testItems.get(i).getStartTime())));
.forEach(i -> assertThat(
(Instant) steps.get(i).getStartTime(),
greaterThanOrEqualTo((Instant) testItems.get(i).getStartTime())
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
import com.epam.ta.reportportal.ws.model.log.SaveLogRQ;
import okhttp3.MultipartBody;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;

import static com.epam.reportportal.junit.utils.TestUtils.PROCESSING_TIMEOUT;
Expand All @@ -47,11 +49,18 @@ public class AssumptionSkipTest {

private final ReportPortalClient client = mock(ReportPortalClient.class);

private final ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, null, classId, methodId);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand All @@ -51,11 +53,18 @@ public class AssumptionViolatedInBeforeTest {

private final ReportPortalClient client = mock(ReportPortalClient.class);

private final ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, null, classId, methodIds);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
import com.epam.ta.reportportal.ws.model.log.SaveLogRQ;
import okhttp3.MultipartBody;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;

import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand All @@ -48,11 +50,18 @@ public class ParameterizedAssumptionSkipTest {

private final ReportPortalClient client = mock(ReportPortalClient.class);

private final ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, null, classId, methodIds);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
Expand All @@ -40,12 +41,18 @@ public class ClassKvAttributeTest {
private final String methodId = CommonUtils.namedId("method_");

private final ReportPortalClient client = mock(ReportPortalClient.class);
private final java.util.concurrent.ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, null, classId, methodId);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;

Expand All @@ -40,11 +41,18 @@ public class KvAttributeTest {

private final ReportPortalClient client = mock(ReportPortalClient.class);

private final java.util.concurrent.ExecutorService executor = CommonUtils.testExecutor();

@BeforeEach
public void setupMock() {
TestUtils.mockLaunch(client, null, null, classId, methodId);
TestUtils.mockBatchLogging(client);
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), TestUtils.testExecutor()));
ReportPortalListener.setReportPortal(ReportPortal.create(client, TestUtils.standardParameters(), executor));
}

@AfterEach
public void tearDown() {
CommonUtils.shutdownExecutorService(executor);
}

@Test
Expand Down
Loading