Skip to content

Commit 3018a21

Browse files
authored
Merge pull request #124 from reportportal/develop
Release
2 parents 07c4478 + 89e0ff8 commit 3018a21

File tree

9 files changed

+83
-37
lines changed

9 files changed

+83
-37
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
3939

4040
- name: Set up JDK 1.8
41-
uses: actions/setup-java@v3
41+
uses: actions/setup-java@v4
4242
with:
4343
distribution: 'temurin'
4444
java-version: '8'
@@ -47,4 +47,6 @@ jobs:
4747
run: ./gradlew build
4848

4949
- name: Codecov upload
50-
run: bash <(curl -s https://codecov.io/bash)
50+
uses: codecov/codecov-action@v4
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v3
43+
uses: actions/checkout@v4
4444

4545
- name: Generate versions
4646
uses: HardNorth/github-version-generate@v1
@@ -50,7 +50,7 @@ jobs:
5050
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}
5151

5252
- name: Set up JDK 1.8
53-
uses: actions/setup-java@v3
53+
uses: actions/setup-java@v4
5454
with:
5555
distribution: 'temurin'
5656
java-version: '8'
@@ -108,7 +108,7 @@ jobs:
108108

109109
- name: Checkout develop branch
110110
if: ${{ github.ref }} == 'master'
111-
uses: actions/checkout@v3
111+
uses: actions/checkout@v4
112112
with:
113113
ref: 'develop'
114114
fetch-depth: 0

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Added
5+
- `finishTest` method which controls finishing Tests with statuses, to distinguish them from suites and configuration methods, by @HardNorth
6+
### Changed
7+
- JUnit 5 dependency marked as `compileOnly` to avoid overriding JUnit 5 API version for users, by @HardNorth
8+
- JSR 305 dependency marked as `implementation` to force users specify their own versions, by @HardNorth
9+
- Client version updated on [5.2.5](https://github.com/reportportal/client-java/releases/tag/5.2.5), by @HardNorth
10+
### Removed
11+
- Setting of Unique ID on Test Step and Configuration start, as redundant action, by @HardNorth
412

513
## [5.2.1]
614
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A JUnit 5 reporter that uploads the results to a ReportPortal server.
88
[![Maven Central](https://img.shields.io/maven-central/v/com.epam.reportportal/agent-java-junit5.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/com.epam.reportportal/agent-java-junit5)
99
[![CI Build](https://github.com/reportportal/agent-java-junit5/actions/workflows/ci.yml/badge.svg)](https://github.com/reportportal/agent-java-junit5/actions/workflows/ci.yml)
1010
[![codecov](https://codecov.io/gh/reportportal/agent-java-junit5/branch/develop/graph/badge.svg?token=tq832Jsqef)](https://codecov.io/gh/reportportal/agent-java-junit5)
11-
[![Join Slack chat!](https://slack.epmrpp.reportportal.io/badge.svg)](https://slack.epmrpp.reportportal.io/)
11+
[![Join Slack chat!](https://img.shields.io/badge/slack-join-brightgreen.svg)](https://slack.epmrpp.reportportal.io/)
1212
[![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal)
1313
[![Build with Love](https://img.shields.io/badge/build%20with-❤%EF%B8%8F%E2%80%8D-lightgrey.svg)](http://reportportal.io?style=flat)
1414

README_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A JUnit 5 reporter that uploads the results to a ReportPortal server.
88
[![Maven Central](https://img.shields.io/maven-central/v/com.epam.reportportal/agent-java-junit5.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/com.epam.reportportal/agent-java-junit5)
99
[![CI Build](https://github.com/reportportal/agent-java-junit5/actions/workflows/ci.yml/badge.svg)](https://github.com/reportportal/agent-java-junit5/actions/workflows/ci.yml)
1010
[![codecov](https://codecov.io/gh/reportportal/agent-java-junit5/branch/develop/graph/badge.svg?token=tq832Jsqef)](https://codecov.io/gh/reportportal/agent-java-junit5)
11-
[![Join Slack chat!](https://slack.epmrpp.reportportal.io/badge.svg)](https://slack.epmrpp.reportportal.io/)
11+
[![Join Slack chat!](https://img.shields.io/badge/slack-join-brightgreen.svg)](https://slack.epmrpp.reportportal.io/)
1212
[![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal)
1313
[![Build with Love](https://img.shields.io/badge/build%20with-❤%EF%B8%8F%E2%80%8D-lightgrey.svg)](http://reportportal.io?style=flat)
1414

build.gradle

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,21 @@ repositories {
3737
}
3838

3939
dependencies {
40-
api 'com.epam.reportportal:client-java:5.2.4'
41-
api 'com.google.code.findbugs:jsr305:3.0.2'
40+
api 'com.epam.reportportal:client-java:5.2.5'
4241

43-
implementation "org.junit.jupiter:junit-jupiter-api:${junit_version}"
42+
compileOnly "org.junit.jupiter:junit-jupiter-api:${junit_version}"
43+
implementation 'com.google.code.findbugs:jsr305:3.0.2'
4444
implementation 'org.slf4j:slf4j-api:2.0.7'
4545

46-
testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.2'
47-
48-
testImplementation ("org.junit.platform:junit-platform-runner:${junit_runner_version}")
49-
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junit_version}"
46+
testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.3'
47+
testImplementation "org.junit.platform:junit-platform-runner:${junit_runner_version}" // We need runner for JUnit 4 compatibility tests
48+
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junit_version}" // Required for tests to run
5049
testImplementation "org.junit.jupiter:junit-jupiter-params:${junit_version}"
5150
testImplementation 'org.aspectj:aspectjweaver:1.9.19'
5251
testImplementation 'org.hamcrest:hamcrest:2.2'
5352
testImplementation 'org.mockito:mockito-core:3.3.3'
5453
testImplementation 'ch.qos.logback:logback-classic:1.3.12'
55-
testImplementation ('com.epam.reportportal:logger-java-logback:5.2.0') {
56-
exclude module: 'client-java'
57-
}
54+
testImplementation 'com.epam.reportportal:logger-java-logback:5.2.2'
5855
testImplementation 'org.assertj:assertj-core:3.23.1'
5956
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
6057
}

gradle.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
version=5.2.2-SNAPSHOT
1+
version=5.3.0-SNAPSHOT
22
description=JUnit5 integration for ReportPortal
3-
junit_version=5.9.1
4-
junit_runner_version=1.9.1
3+
junit_version=5.9.3
4+
# We need runner for JUnit 4 compatibility tests
5+
junit_runner_version=1.9.3
56
scripts_url=https://raw.githubusercontent.com/reportportal/gradle-scripts
67
scripts_branch=master
78
excludeTests=

src/main/java/com/epam/reportportal/junit5/ReportPortalExtension.java

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ public void interceptDynamicTest(Invocation<Void> invocation, DynamicTestInvocat
316316
startTestItem(extensionContext, STEP);
317317
try {
318318
invocation.proceed();
319-
finishTestItem(extensionContext, PASSED);
319+
finishTest(extensionContext, PASSED);
320320
} catch (Throwable throwable) {
321-
finishTestItem(extensionContext, getExecutionStatus(throwable));
321+
finishTest(extensionContext, getExecutionStatus(throwable));
322322
throw throwable;
323323
}
324324
}
@@ -344,33 +344,25 @@ protected ItemStatus getExecutionStatus(@Nonnull final ExtensionContext context)
344344
@Override
345345
public void afterTestExecution(ExtensionContext context) {
346346
finishTemplates(context);
347-
finishTestItem(context, getExecutionStatus(context));
347+
finishTest(context, getExecutionStatus(context));
348348
}
349349

350350
@Override
351351
public void testDisabled(ExtensionContext context, Optional<String> reason) {
352352
if (Boolean.parseBoolean(System.getProperty("reportDisabledTests"))) {
353353
String description = reason.orElse(createStepDescription(context));
354354
startTestItem(context, Collections.emptyList(), STEP, description, Calendar.getInstance().getTime());
355-
finishTestItem(context, SKIPPED);
355+
finishTest(context, SKIPPED);
356356
}
357357
}
358358

359-
@Override
360-
public void testSuccessful(ExtensionContext context) {
361-
}
362-
363-
@Override
364-
public void testAborted(ExtensionContext context, Throwable throwable) {
365-
}
366-
367359
@Override
368360
public void testFailed(ExtensionContext context, Throwable cause) {
369361
context.getParent().ifPresent(parent -> {
370362
if(failedClassInits.contains(parent)) {
371363
startTestItem(context, STEP);
372364
sendStackTraceToRP(cause);
373-
finishTestItem(context, FAILED);
365+
finishTest(context, FAILED);
374366
}
375367
});
376368
}
@@ -554,6 +546,16 @@ protected void finishTestItem(@Nonnull final ExtensionContext context, @Nullable
554546
finishTestItem(context, buildFinishTestItemRq(context, status));
555547
}
556548

549+
/**
550+
* Finishes a test in RP with a specific status, builds a finish request based on the status
551+
*
552+
* @param context JUnit's test context
553+
* @param status a test execution status
554+
*/
555+
protected void finishTest(@Nonnull final ExtensionContext context, @Nullable final ItemStatus status) {
556+
finishTestItem(context, buildFinishTestRq(context, status));
557+
}
558+
557559
/**
558560
* Finishes a test item in RP with a custom request
559561
*
@@ -673,7 +675,6 @@ protected StartTestItemRQ buildStartStepRq(@Nonnull final ExtensionContext conte
673675
rq.setStartTime(startTime);
674676
rq.setName(createStepName(context));
675677
rq.setDescription(description);
676-
rq.setUniqueId(context.getUniqueId());
677678
rq.setType(itemType == TEMPLATE ? SUITE.name() : itemType.name());
678679
String codeRef = getCodeRef(context);
679680
rq.setCodeRef(codeRef);
@@ -705,6 +706,7 @@ protected StartTestItemRQ buildStartStepRq(@Nonnull final ExtensionContext conte
705706
* @return Request to ReportPortal
706707
*/
707708
@Nonnull
709+
@SuppressWarnings("unused")
708710
protected StartTestItemRQ buildStartConfigurationRq(@Nonnull Method method, @Nonnull ExtensionContext parentContext,
709711
@Nonnull ExtensionContext context, @Nonnull ItemType itemType) {
710712
StartTestItemRQ rq = new StartTestItemRQ();
@@ -717,8 +719,6 @@ protected StartTestItemRQ buildStartConfigurationRq(@Nonnull Method method, @Non
717719
rq.setName(createConfigurationName(method.getDeclaringClass(), method));
718720
rq.setDescription(createConfigurationDescription(method.getDeclaringClass(), method));
719721
}
720-
String uniqueId = parentContext.getUniqueId() + "/[method:" + method.getName() + "()]";
721-
rq.setUniqueId(uniqueId);
722722
ofNullable(context.getTags()).ifPresent(it -> rq.setAttributes(it.stream()
723723
.map(tag -> new ItemAttributesRQ(null, tag))
724724
.collect(Collectors.toSet())));
@@ -743,6 +743,22 @@ protected StartTestItemRQ buildStartConfigurationRq(@Nonnull Method method, @Non
743743
protected void createSkippedSteps(ExtensionContext context, Throwable cause) {
744744
}
745745

746+
/**
747+
* Extension point to customize a test result on it's finish
748+
*
749+
* @param context JUnit's test context
750+
* @param status a test item execution result
751+
* @return Request to ReportPortal
752+
*/
753+
@SuppressWarnings("unused")
754+
@Nonnull
755+
protected FinishTestItemRQ buildFinishTestRq(@Nonnull ExtensionContext context, @Nullable ItemStatus status) {
756+
FinishTestItemRQ rq = new FinishTestItemRQ();
757+
ofNullable(status).ifPresent(s -> rq.setStatus(s.name()));
758+
rq.setEndTime(Calendar.getInstance().getTime());
759+
return rq;
760+
}
761+
746762
/**
747763
* Extension point to customize a test item result on it's finish
748764
*
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
~ Copyright 2024 EPAM Systems
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ https://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<aspectj>
18+
<weaver options="-nowarn -Xset:weaveJavaPackages=false,weaveJavaxPackages=false" />
19+
<aspects>
20+
<aspect name="com.epam.reportportal.aspect.StepAspect"/>
21+
</aspects>
22+
</aspectj>

0 commit comments

Comments
 (0)