Skip to content

Commit

Permalink
Merge pull request #61 from reportportal/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
HardNorth committed Apr 20, 2022
2 parents fe866db + 76466ca commit a8bda16
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## [Unreleased]
### Added
- Test Case ID templating, by @HardNorth
### Changed
- Client version updated on [5.1.9](https://github.com/reportportal/client-java/releases/tag/5.1.9), by @HardNorth
- Slf4j version updated on 1.7.36, by @HardNorth
- Jbehave version was updated on version 4.8.3, by @HardNorth

## [5.1.1]
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> ReportPortal team only and is not supposed for sharing with 3rd parties.
[![Maven Central](https://img.shields.io/maven-central/v/com.epam.reportportal/agent-java-jbehave.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.epam.reportportal%22%20AND%20a:%22agent-java-jbehave%22)
![CI Build](https://github.com/reportportal/agent-java-jbehave/workflows/CI%20Build/badge.svg?branch=develop)
[![CI Build](https://github.com/reportportal/agent-java-jbehave/actions/workflows/ci.yml/badge.svg)](https://github.com/reportportal/agent-java-jbehave/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/reportportal/agent-java-jbehave/branch/develop/graph/badge.svg?token=BCglguEcoR)](https://codecov.io/gh/reportportal/agent-java-jbehave)
[![Join Slack chat!](https://reportportal-slack-auto.herokuapp.com/badge.svg)](https://reportportal-slack-auto.herokuapp.com)
[![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal)
Expand Down Expand Up @@ -154,7 +154,7 @@ dependencies {
testCompile "org.jbehave:jbehave-core:${jbehaveVersion}"
testCompile "org.jbehave:jbehave-navigator:${jbehaveVersion}"
testCompile 'com.epam.reportportal:agent-java-jbehave:5.1.1'
testCompile 'com.epam.reportportal:logger-java-logback:5.1.0'
testCompile 'com.epam.reportportal:logger-java-logback:5.1.1'
}
test {
Expand Down Expand Up @@ -246,7 +246,7 @@ To route your logs into Report Portal you should add `logger-java-logback` depen

```groovy
// inside 'dependencies' section
testCompile 'com.epam.reportportal:logger-java-logback:5.1.0'
testCompile 'com.epam.reportportal:logger-java-logback:5.1.1'
```

It should be already here if you used gradle configuration listed above.
Expand Down
6 changes: 3 additions & 3 deletions README_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> ReportPortal team only and is not supposed for sharing with 3rd parties.
[![Maven Central](https://img.shields.io/maven-central/v/com.epam.reportportal/agent-java-jbehave.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.epam.reportportal%22%20AND%20a:%22agent-java-jbehave%22)
![CI Build](https://github.com/reportportal/agent-java-jbehave/workflows/CI%20Build/badge.svg?branch=develop)
[![CI Build](https://github.com/reportportal/agent-java-jbehave/actions/workflows/ci.yml/badge.svg)](https://github.com/reportportal/agent-java-jbehave/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/reportportal/agent-java-jbehave/branch/develop/graph/badge.svg?token=BCglguEcoR)](https://codecov.io/gh/reportportal/agent-java-jbehave)
[![Join Slack chat!](https://reportportal-slack-auto.herokuapp.com/badge.svg)](https://reportportal-slack-auto.herokuapp.com)
[![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal)
Expand Down Expand Up @@ -154,7 +154,7 @@ dependencies {
testCompile "org.jbehave:jbehave-core:${jbehaveVersion}"
testCompile "org.jbehave:jbehave-navigator:${jbehaveVersion}"
testCompile 'com.epam.reportportal:agent-java-jbehave:$LATEST_VERSION'
testCompile 'com.epam.reportportal:logger-java-logback:5.1.0'
testCompile 'com.epam.reportportal:logger-java-logback:5.1.1'
}
test {
Expand Down Expand Up @@ -246,7 +246,7 @@ To route your logs into Report Portal you should add `logger-java-logback` depen

```groovy
// inside 'dependencies' section
testCompile 'com.epam.reportportal:logger-java-logback:5.1.0'
testCompile 'com.epam.reportportal:logger-java-logback:5.1.1'
```

It should be already here if you used gradle configuration listed above.
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ repositories {
}

dependencies {
api 'com.epam.reportportal:client-java:5.1.0'
api 'com.epam.reportportal:client-java:5.1.9'
api 'com.epam.reportportal:commons-model:5.0.0'
api ("org.jbehave:jbehave-core:${project.jbehave_version}") {
exclude group: 'org.hamcrest'
exclude group: 'junit'
}
api 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.slf4j:slf4j-api:1.7.36'

testImplementation 'com.github.reportportal:agent-java-test-utils:ddcf50ee20'
testImplementation 'com.github.reportportal:agent-java-test-utils:236a68c'
testImplementation 'org.aspectj:aspectjweaver:1.9.2'
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.2.3'
testImplementation 'com.epam.reportportal:logger-java-logback:5.0.3'
testImplementation 'ch.qos.logback:logback-classic:1.2.11'
testImplementation 'com.epam.reportportal:logger-java-logback:5.1.1'
testImplementation ("org.junit.platform:junit-platform-runner:${project.junit5_launcher_version}") {
exclude module: 'junit'
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
version=5.1.2-SNAPSHOT
description=JBehave reporters for Report Portal
jbehave_version=4.8.1
jbehave_version=4.8.3
junit5_version=5.6.3
junit5_launcher_version=1.6.3
mockito_version=3.3.3
Expand Down
25 changes: 12 additions & 13 deletions src/test/java/com/epam/reportportal/jbehave/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static com.epam.reportportal.util.test.CommonUtils.createMaybe;
import static com.epam.reportportal.util.test.CommonUtils.generateUniqueId;
import static java.util.Optional.ofNullable;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down Expand Up @@ -139,8 +138,8 @@ public static void mockLaunch(@Nonnull final ReportPortalClient client, @Nullabl
public static <T extends Collection<String>> void mockLaunch(@Nonnull final ReportPortalClient client,
@Nullable final String launchUuid, @Nullable final String storyUuid, @Nonnull final Collection<Pair<String, T>> testSteps) {
String launch = ofNullable(launchUuid).orElse(CommonUtils.namedId("launch_"));
when(client.startLaunch(any())).thenReturn(createMaybe(new StartLaunchRS(launch, 1L)));
when(client.finishLaunch(eq(launch), any())).thenReturn(createMaybe(new OperationCompletionRS()));
when(client.startLaunch(any())).thenReturn(Maybe.just(new StartLaunchRS(launch, 1L)));
when(client.finishLaunch(eq(launch), any())).thenReturn(Maybe.just(new OperationCompletionRS()));

mockStory(client, storyUuid, testSteps);
}
Expand All @@ -158,16 +157,16 @@ public static <T extends Collection<String>> void mockStories(@Nonnull final Rep
return;
}
String firstStory = stories.get(0).getKey();
Maybe<ItemCreatedRS> first = createMaybe(new ItemCreatedRS(firstStory, firstStory));
Maybe<ItemCreatedRS> first = Maybe.just(new ItemCreatedRS(firstStory, firstStory));
Maybe<ItemCreatedRS>[] other = (Maybe<ItemCreatedRS>[]) stories.subList(1, stories.size())
.stream()
.map(Pair::getKey)
.map(s -> createMaybe(new ItemCreatedRS(s, s)))
.map(s -> Maybe.just(new ItemCreatedRS(s, s)))
.toArray(Maybe[]::new);
when(client.startTestItem(any())).thenReturn(first, other);

stories.forEach(i -> {
Maybe<OperationCompletionRS> rootFinishMaybe = createMaybe(new OperationCompletionRS());
Maybe<OperationCompletionRS> rootFinishMaybe = Maybe.just(new OperationCompletionRS());
when(client.finishTestItem(same(i.getKey()), any())).thenReturn(rootFinishMaybe);
mockScenario(client, i.getKey(), i.getValue());
});
Expand All @@ -178,7 +177,7 @@ public static <T extends Collection<String>> void mockScenario(@Nonnull final Re
@Nonnull final String storyUuid, @Nonnull final Collection<Pair<String, T>> testSteps) {
List<Maybe<ItemCreatedRS>> testResponses = testSteps.stream()
.map(Pair::getKey)
.map(uuid -> createMaybe(new ItemCreatedRS(uuid, uuid)))
.map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid)))
.collect(Collectors.toList());

Maybe<ItemCreatedRS> first = testResponses.get(0);
Expand All @@ -189,23 +188,23 @@ public static <T extends Collection<String>> void mockScenario(@Nonnull final Re
String testClassUuid = test.getKey();
List<Maybe<ItemCreatedRS>> stepResponses = test.getValue()
.stream()
.map(uuid -> createMaybe(new ItemCreatedRS(uuid, uuid)))
.map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid)))
.collect(Collectors.toList());
when(client.finishTestItem(same(testClassUuid), any())).thenReturn(createMaybe(new OperationCompletionRS()));
when(client.finishTestItem(same(testClassUuid), any())).thenReturn(Maybe.just(new OperationCompletionRS()));
if (!stepResponses.isEmpty()) {
Maybe<ItemCreatedRS> myFirst = stepResponses.get(0);
Maybe<ItemCreatedRS>[] myOther = stepResponses.subList(1, stepResponses.size()).toArray(new Maybe[0]);
when(client.startTestItem(same(testClassUuid), any())).thenReturn(myFirst, myOther);
new HashSet<>(test.getValue()).forEach(testMethodUuid -> when(client.finishTestItem(same(testMethodUuid),
any()
)).thenReturn(createMaybe(new OperationCompletionRS())));
)).thenReturn(Maybe.just(new OperationCompletionRS())));
}
});
}

@SuppressWarnings("unchecked")
public static void mockBatchLogging(final ReportPortalClient client) {
when(client.log(any(List.class))).thenReturn(createMaybe(new BatchSaveOperatingRS()));
when(client.log(any(List.class))).thenReturn(Maybe.just(new BatchSaveOperatingRS()));
}

public static void mockNestedSteps(final ReportPortalClient client, final Pair<String, String> parentNestedPair) {
Expand All @@ -218,7 +217,7 @@ public static void mockNestedSteps(final ReportPortalClient client, final List<P
.collect(Collectors.groupingBy(Pair::getKey, Collectors.mapping(Pair::getValue, Collectors.toList())));
responseOrders.forEach((k, v) -> {
List<Maybe<ItemCreatedRS>> responses = v.stream()
.map(uuid -> createMaybe(new ItemCreatedRS(uuid, uuid)))
.map(uuid -> Maybe.just(new ItemCreatedRS(uuid, uuid)))
.collect(Collectors.toList());

Maybe<ItemCreatedRS> first = responses.get(0);
Expand All @@ -227,7 +226,7 @@ public static void mockNestedSteps(final ReportPortalClient client, final List<P
});
parentNestedPairs.forEach(p -> when(client.finishTestItem(same(p.getValue()),
any()
)).thenAnswer((Answer<Maybe<OperationCompletionRS>>) invocation -> createMaybe(new OperationCompletionRS())));
)).thenAnswer((Answer<Maybe<OperationCompletionRS>>) invocation -> Maybe.just(new OperationCompletionRS())));
}

public static ListenerParameters standardParameters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.epam.ta.reportportal.ws.model.EntryCreatedAsyncRS;
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
import com.epam.ta.reportportal.ws.model.log.SaveLogRQ;
import io.reactivex.Maybe;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -62,7 +63,7 @@ public class CallbackReportingTest extends BaseTest {
@BeforeEach
public void setup() {
mockLaunch(client, launchId, suiteId, tests);
when(client.log(any(SaveLogRQ.class))).thenReturn(CommonUtils.createMaybe(new EntryCreatedAsyncRS()));
when(client.log(any(SaveLogRQ.class))).thenReturn(Maybe.just(new EntryCreatedAsyncRS()));
}

private static final String STORY_PATH = "stories/CallbackReportingScenario.story";
Expand Down

0 comments on commit a8bda16

Please sign in to comment.