From aa44e4c512037e2c3f067ff6ce974a0afe98caef Mon Sep 17 00:00:00 2001 From: Yevhen Surovskyi <66682229+ajax-surovskyi-y@users.noreply.github.com> Date: Thu, 11 Jan 2024 10:42:37 +0200 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b204dd0..3a3cbb1 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The repository contains [JUnit5 Extension](https://junit.org/junit5/docs/current To start using ReportPortal with JUnit 5 create a service location file: 1. Create folders **_/META-INF/services_** in **_resources_** -2. Put there a file named **_org.junit.jupiter.api.extension.Extension_**ы +2. Put there a file named **_org.junit.jupiter.api.extension.Extension_** 3. Put a default implementation reference as a single row into the file: **_com.epam.reportportal.junit5.ReportPortalExtension_** Example: From d3f1926f0ef87d5b8b5a38007e7603801e83f4ca Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 23 Jan 2024 11:58:53 +0300 Subject: [PATCH 2/6] Version update --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e671c8d..d2f27d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=5.1.12-SNAPSHOT +version=5.2.0-SNAPSHOT description=JUnit5 integration for ReportPortal junit_version=5.9.1 junit_runner_version=1.9.1 From cfcdebb2a8b38d2747cc190c07143a649c949ab5 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 23 Jan 2024 11:59:07 +0300 Subject: [PATCH 3/6] Client version update --- CHANGELOG.md | 5 +++++ build.gradle | 8 ++++---- .../reportportal/junit5/ReportPortalExtension.java | 14 +++----------- .../junit5/SystemAttributesFetcher.java | 1 - 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41db2db..be5f99f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog ## [Unreleased] +### Changed +- Client version updated on [5.2.0](https://github.com/reportportal/client-java/releases/tag/5.2.0), by @HardNorth +- JUnit 5 dependency marked as `implementation` to force users specify their own versions, by @HardNorth +### Removed +- Deprecated code, by @HardNorth ## [5.1.11] ### Changed diff --git a/build.gradle b/build.gradle index 9e964f6..62f404a 100644 --- a/build.gradle +++ b/build.gradle @@ -37,10 +37,10 @@ repositories { } dependencies { - api 'com.epam.reportportal:client-java:5.1.24' + api 'com.epam.reportportal:client-java:5.2.1' api 'com.google.code.findbugs:jsr305:3.0.2' - api "org.junit.jupiter:junit-jupiter-api:${junit_version}" + implementation "org.junit.jupiter:junit-jupiter-api:${junit_version}" implementation 'org.slf4j:slf4j-api:2.0.7' testImplementation 'com.epam.reportportal:agent-java-test-utils:0.0.2' @@ -51,8 +51,8 @@ dependencies { testImplementation 'org.aspectj:aspectjweaver:1.9.19' testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation 'org.mockito:mockito-core:3.3.3' - testImplementation 'ch.qos.logback:logback-classic:1.3.8' - testImplementation ('com.epam.reportportal:logger-java-logback:5.1.5') { + testImplementation 'ch.qos.logback:logback-classic:1.3.12' + testImplementation ('com.epam.reportportal:logger-java-logback:5.2.0') { exclude module: 'client-java' } testImplementation 'org.assertj:assertj-core:3.23.1' diff --git a/src/main/java/com/epam/reportportal/junit5/ReportPortalExtension.java b/src/main/java/com/epam/reportportal/junit5/ReportPortalExtension.java index b29b7e1..e428f87 100644 --- a/src/main/java/com/epam/reportportal/junit5/ReportPortalExtension.java +++ b/src/main/java/com/epam/reportportal/junit5/ReportPortalExtension.java @@ -98,6 +98,7 @@ protected Optional> getItemId(@Nonnull ExtensionContext context) { /** * Finishes all launches for the JVM */ + @SuppressWarnings("unused") public void finish() { new ArrayList<>(launchMap.keySet()).forEach(this::finish); } @@ -429,6 +430,7 @@ private void finishBeforeAfter(Invocation invocation, ExtensionContext con private void finishBeforeAfter(ExtensionContext context, Maybe id, ItemStatus status) { Launch launch = getLaunch(context); + //noinspection ReactiveStreamsUnusedPublisher launch.finishTestItem(id, buildFinishTestItemRq(context, status)); } @@ -520,17 +522,6 @@ protected Maybe startBeforeAfter(Method method, ExtensionContext parentC .orElseGet(() -> launch.startTestItem(rq)); } - /** - * Finish a test template execution (basically a test class) with a specific status, builds a finish request based on the status - * - * @param context JUnit's test context - * @param status an {@link ItemStatus} - * @deprecated the method not in use anymore, use {@link #finishTemplate(ExtensionContext)} - */ - protected void finishTemplate(@Nonnull final ExtensionContext context, @Nullable final ItemStatus status) { - finishTemplate(context); - } - /** * Finish a test template execution (basically a test class) with a specific status, builds a finish request based on the status * @@ -539,6 +530,7 @@ protected void finishTemplate(@Nonnull final ExtensionContext context, @Nullable protected void finishTemplate(@Nonnull final ExtensionContext context) { Launch launch = getLaunch(context); Maybe templateId = testTemplates.remove(context); + //noinspection ReactiveStreamsUnusedPublisher launch.finishTestItem(templateId, buildFinishTestItemRq(context, null)); idMapping.remove(context); } diff --git a/src/main/java/com/epam/reportportal/junit5/SystemAttributesFetcher.java b/src/main/java/com/epam/reportportal/junit5/SystemAttributesFetcher.java index e4096e2..bfe6c91 100644 --- a/src/main/java/com/epam/reportportal/junit5/SystemAttributesFetcher.java +++ b/src/main/java/com/epam/reportportal/junit5/SystemAttributesFetcher.java @@ -39,7 +39,6 @@ private static ItemAttributesRQ skippedAnIssue(Boolean fromParams) { } static Set collectSystemAttributes(Boolean skippedAnIssue) { - Set systemAttributes = SystemAttributesExtractor.extract(AGENT_PROPERTIES, SystemAttributesFetcher.class.getClassLoader()); systemAttributes.add(skippedAnIssue(skippedAnIssue)); return systemAttributes; From 71fd89c2c94c1f8f3e42d784ff60300458a9da7d Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 23 Jan 2024 12:14:55 +0300 Subject: [PATCH 4/6] Update tests --- .../junit5/features/JUnit5Tests.java | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/test/java/com/epam/reportportal/junit5/features/JUnit5Tests.java b/src/test/java/com/epam/reportportal/junit5/features/JUnit5Tests.java index 69c0357..bd03b0c 100644 --- a/src/test/java/com/epam/reportportal/junit5/features/JUnit5Tests.java +++ b/src/test/java/com/epam/reportportal/junit5/features/JUnit5Tests.java @@ -1,8 +1,6 @@ package com.epam.reportportal.junit5.features; import com.epam.reportportal.service.ReportPortal; -import com.google.common.io.Files; -import com.google.common.io.Resources; import org.junit.jupiter.api.*; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.*; @@ -34,10 +32,7 @@ void initializeBaseClass() { @Tag("tag2") void baseClassTest() throws IOException { // Report launch log - File file = File.createTempFile("rp-test", ".css"); - Resources.asByteSource(Resources.getResource("files/css.css")).copyTo(Files.asByteSink(file)); - ReportPortal.emitLaunchLog("LAUNCH LOG MESAGE WITH ATTACHMENT", "error", new Date(), file); - + ReportPortal.emitLaunchLog("LAUNCH LOG MESAGE WITH ATTACHMENT", "error", new Date(), new File("files/css.css")); System.out.println("base-class-test"); } @@ -58,13 +53,13 @@ void parameterizedTestWithMethodSource(String value) { } @ParameterizedTest - @CsvSource({"first", "second", "third"}) + @CsvSource({ "first", "second", "third" }) void parameterizedTestWithCsvSource(String value) { System.out.println("parameterized-test-with-csv-source, parameter: " + value); } @ParameterizedTest - @EnumSource(value = DayOfWeek.class, names = {"MONDAY", "WEDNESDAY", "FRIDAY"}) + @EnumSource(value = DayOfWeek.class, names = { "MONDAY", "WEDNESDAY", "FRIDAY" }) void parameterizedTestWithEnumSource(DayOfWeek day) { System.out.println("parameterized-test-with-enum-source, parameter: " + day); } @@ -77,7 +72,7 @@ void parameterizedTestWithNullSource(String value) { @ParameterizedTest @NullSource - @ValueSource(strings = {"a", "b", "c"}) + @ValueSource(strings = { "a", "b", "c" }) void parameterizedTestWithNullSourceAndValueSource(String value) { System.out.println("parameterized-test-with-null-source-and-value-source, parameter: " + value); } @@ -90,7 +85,7 @@ void parameterizedTestWithEmptySource(String value) { @ParameterizedTest @EmptySource - @ValueSource(strings = {"a", "b", "c"}) + @ValueSource(strings = { "a", "b", "c" }) void parameterizedTestWithEmptySourceAndValueSource(String value) { System.out.println("parameterized-test-with-empty-source-and-value-source, parameter: " + value); } @@ -98,7 +93,7 @@ void parameterizedTestWithEmptySourceAndValueSource(String value) { @ParameterizedTest @NullSource @EmptySource - @ValueSource(strings = {"a", "b", "c"}) + @ValueSource(strings = { "a", "b", "c" }) void parameterizedTestWithNullSourceAndEmptySourceAndValueSource(String value) { System.out.println("parameterized-test-with-null-source-empty-source-and-value-source, parameter: " + value); } @@ -111,55 +106,55 @@ void parameterizedTestWithNullAndEmptySource(String value) { @ParameterizedTest @NullAndEmptySource - @ValueSource(strings = {"a", "b", "c"}) + @ValueSource(strings = { "a", "b", "c" }) void parameterizedTestWithNullAndEmptySourceAndValueSource(String value) { System.out.println("parameterized-test-with-null-and-empty-source-and-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(floats = {1.1f, 2.2f, 3.3f}) + @ValueSource(floats = { 1.1f, 2.2f, 3.3f }) void parameterizedTestWithFloatsValueSource(float value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(ints = {1, 2, 3}) + @ValueSource(ints = { 1, 2, 3 }) void parameterizedTestWithIntValueSource(int value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(shorts = {1, 2, 3}) + @ValueSource(shorts = { 1, 2, 3 }) void parameterizedTestWithShortsValueSource(short value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(bytes = {1, 2, 3}) + @ValueSource(bytes = { 1, 2, 3 }) void parameterizedTestWithBytesValueSource(byte value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(chars = {'a', 'b', 'c'}) + @ValueSource(chars = { 'a', 'b', 'c' }) void parameterizedTestWithCharsValueSource(char value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(doubles = {1.1, 2.2, 3.3}) + @ValueSource(doubles = { 1.1, 2.2, 3.3 }) void parameterizedTestWithDoublesValueSource(double value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(longs = {1147483648L, 2147483648L, 3147483648L}) + @ValueSource(longs = { 1147483648L, 2147483648L, 3147483648L }) void parameterizedTestWithLongsValueSource(long value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } @ParameterizedTest - @ValueSource(strings = {"a", "b", "c"}) + @ValueSource(strings = { "a", "b", "c" }) void parameterizedTestWithStringsValueSource(String value) { System.out.println("parameterized-test-with-value-source, parameter: " + value); } From c640ff39b8d57ca088cb18db9536d978ebb721b4 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 23 Jan 2024 12:15:13 +0300 Subject: [PATCH 5/6] Add Okhttp3 as test dependency --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 62f404a..b58cefa 100644 --- a/build.gradle +++ b/build.gradle @@ -56,6 +56,7 @@ dependencies { exclude module: 'client-java' } testImplementation 'org.assertj:assertj-core:3.23.1' + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' } test { From 924a0fb32677c7375a6997af14ba9d97f450155d Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 23 Jan 2024 16:17:58 +0300 Subject: [PATCH 6/6] READMEs update --- README.md | 2 +- README_TEMPLATE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a3cbb1..8b1b52f 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ By this moment, your project tree should look somewhat like the this: Go to *http:$IP_ADDRESS_OF_REPORT_PORTAL:8080* (by default it is *http://localhost:8080*) -Login as **Admin** user and create the project (more details [here](http://reportportal.io/docs/Deploy-ReportPortal) and [here](http://reportportal.io/docs/Creation-of-project)) +Login as **Admin** user and create the project (more details [here](https://reportportal.io/docs/category/installation-steps) and [here](https://reportportal.io/docs/reportportal-configuration/CreationOfProjectAndAddingUsers/#create-a-project)) ![RP. Add Project](integration_manual_files/step_add_project.png) diff --git a/README_TEMPLATE.md b/README_TEMPLATE.md index e429075..169bec1 100644 --- a/README_TEMPLATE.md +++ b/README_TEMPLATE.md @@ -247,7 +247,7 @@ By this moment, your project tree should look somewhat like the this: Go to *http:$IP_ADDRESS_OF_REPORT_PORTAL:8080* (by default it is *http://localhost:8080*) -Login as **Admin** user and create the project (more details [here](http://reportportal.io/docs/Deploy-ReportPortal) and [here](http://reportportal.io/docs/Creation-of-project)) +Login as **Admin** user and create the project (more details [here](https://reportportal.io/docs/category/installation-steps) and [here](https://reportportal.io/docs/reportportal-configuration/CreationOfProjectAndAddingUsers/#create-a-project)) ![RP. Add Project](integration_manual_files/step_add_project.png)