Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #98

Merged
merged 6 commits into from
Jan 22, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
### Changed
- Client version updated on [5.2.0](https://github.com/reportportal/client-java/releases/tag/5.2.0), by @HardNorth

## [5.1.4]
### Changed
Expand Down
152 changes: 78 additions & 74 deletions README.md

Large diffs are not rendered by default.

143 changes: 72 additions & 71 deletions README_TEMPLATE.md

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ repositories {
}

dependencies {
api 'com.epam.reportportal:client-java:5.1.22'
api 'com.epam.reportportal:client-java:5.2.1'
api 'com.epam.reportportal:commons-model:5.0.0'
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'info.cukes:gherkin:2.12.2'

implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation 'org.apache.commons:commons-text:1.10.0'

Expand All @@ -53,8 +54,8 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest-core:2.2'
testImplementation 'org.mockito:mockito-core:3.3.3'
testImplementation 'org.mockito:mockito-junit-jupiter: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'

testImplementation ("org.junit.platform:junit-platform-runner:${project.junit_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.1.5-SNAPSHOT
version=5.2.0-SNAPSHOT
description=EPAM Report portal. Cucumber JVM version [1.0.0; 2.0.0) adapter
cucumber_version=1.2.6
junit_version=5.6.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import com.epam.reportportal.service.item.TestCaseIdEntry;
import com.epam.reportportal.service.tree.TestItemTree;
import com.epam.reportportal.utils.*;
import com.epam.reportportal.utils.files.ByteSource;
import com.epam.reportportal.utils.properties.SystemAttributesExtractor;
import com.epam.ta.reportportal.ws.model.FinishExecutionRQ;
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
import com.epam.ta.reportportal.ws.model.ParameterResource;
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ;
import com.google.common.io.ByteSource;
import gherkin.formatter.Argument;
import gherkin.formatter.Formatter;
import gherkin.formatter.Reporter;
Expand Down Expand Up @@ -128,6 +128,7 @@ public Launch get() {
}
});

@Nonnull
public static ReportPortal getReportPortal() {
return REPORT_PORTAL;
}
Expand Down Expand Up @@ -169,7 +170,8 @@ private void addToTree(RunningContext.FeatureContext context) {
* @param scenario Cucumber's Scenario object
* @return scenario name
*/
protected String buildScenarioName(Scenario scenario) {
@Nonnull
protected String buildScenarioName(@Nonnull Scenario scenario) {
return Utils.buildName(scenario.getKeyword(), COLON_INFIX, scenario.getName());
}

Expand Down Expand Up @@ -246,6 +248,7 @@ protected void beforeScenario(Scenario scenario, String outlineIteration) {
// because it will be executed even if all Scenarios in the Feature are excluded.
RunningContext.FeatureContext featureContext = currentFeatureContext.get();
Launch myLaunch = launch.get();
//noinspection ReactiveStreamsUnusedPublisher
if (null == featureContext.getId()) {
featureContext.setId(startFeature(featureContext.getItemRq()));
addToTree(featureContext);
Expand Down Expand Up @@ -293,6 +296,7 @@ protected void finishTestItem(@Nullable Maybe<String> itemId, @Nullable ItemStat
LOGGER.error("BUG: Trying to finish unspecified test item.");
return;
}
//noinspection ReactiveStreamsUnusedPublisher
launch.get().finishTestItem(itemId, buildFinishTestItemRequest(itemId, status));
}

Expand All @@ -302,7 +306,7 @@ protected void finishTestItem(@Nullable Maybe<String> itemId, @Nullable ItemStat
protected void afterScenario() {
RunningContext.ScenarioContext context = getCurrentScenarioContext();
finishTestItem(context.getId(), context.getStatus());
currentScenarioContext.set(null);
currentScenarioContext.remove();
removeFromTree(currentFeatureContext.get(), context);
}

Expand Down Expand Up @@ -342,6 +346,7 @@ protected void beforeFeature(Feature feature) {
*/
protected void afterFeature() {
RunningContext.FeatureContext currentFeature = currentFeatureContext.get();
//noinspection ReactiveStreamsUnusedPublisher
if (null != currentFeature && null != currentFeature.getId()) {
finishTestItem(currentFeature.getId());
}
Expand Down Expand Up @@ -923,7 +928,7 @@ protected Set<ItemAttributesRQ> getAttributes(Match match) {
protected String buildMultilineArgument(Step step) {
StringBuilder marg = new StringBuilder();
ofNullable(step.getRows()).map(rows -> rows.stream().map(Row::getCells).collect(Collectors.toList()))
.filter(t -> t.size() > 0)
.filter(t -> !t.isEmpty())
.ifPresent(t -> marg.append(formatDataTable(t)));
ofNullable(step.getDocString()).map(DocString::getValue)
.filter(ds -> !ds.isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
* created in hooks will be attached to these, and not to the actual failing
* steps!)
*
* @author Sergey_Gvozdyukevich
* @deprecated Use {@link ScenarioReporter}, since the semantic of this class is completely broken and will be removed
*/
@Deprecated
public class StepReporter extends AbstractReporter {
private static final String RP_STORY_TYPE = "STORY";
private static final String RP_TEST_TYPE = "SCENARIO";
Expand Down
33 changes: 15 additions & 18 deletions src/main/java/com/epam/reportportal/cucumber/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
package com.epam.reportportal.cucumber;

import com.epam.reportportal.listeners.ItemStatus;
import com.google.common.collect.ImmutableMap;
import gherkin.formatter.Argument;
import gherkin.formatter.model.Match;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand All @@ -42,21 +39,21 @@ public class Utils {
public static final String TABLE_COLUMN_SEPARATOR = "|";
public static final String TABLE_ROW_SEPARATOR = "-";

//@formatter:off
public static final Map<String, ItemStatus> STATUS_MAPPING = ImmutableMap.<String, ItemStatus>builder()
.put("passed", ItemStatus.PASSED)
.put("failed", ItemStatus.FAILED)
.put("skipped", ItemStatus.SKIPPED)
.put("pending", ItemStatus.SKIPPED)
.put("undefined", ItemStatus.SKIPPED).build();
public static final Map<String, ItemStatus> STATUS_MAPPING = Collections.unmodifiableMap(new HashMap<String, ItemStatus>() {{
put("passed", ItemStatus.PASSED);
put("failed", ItemStatus.FAILED);
put("skipped", ItemStatus.SKIPPED);
put("pending", ItemStatus.SKIPPED);
put("undefined", ItemStatus.SKIPPED);
}});

public static final Map<String, String> LOG_LEVEL_MAPPING = ImmutableMap.<String, String>builder()
.put("passed", "INFO")
.put("failed", "ERROR")
.put("skipped", "WARN")
.put("pending", "WARN")
.put("undefined", "WARN").build();
//@formatter:on
public static final Map<String, String> LOG_LEVEL_MAPPING = Collections.unmodifiableMap(new HashMap<String, String>() {{
put("passed", "INFO");
put("failed", "ERROR");
put("skipped", "WARN");
put("pending", "WARN");
put("undefined", "WARN");
}});

private Utils() {
}
Expand Down