Skip to content

Commit

Permalink
[Cucumber_4] Unit tests were fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem_Oliinyk authored and Artem_Oliinyk committed Apr 30, 2024
1 parent b9c273d commit 8de5405
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/test/java/com/epam/reportportal/cucumber/FailedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@

import static com.epam.reportportal.cucumber.integration.util.TestUtils.filterLogs;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.startsWith;
import static org.mockito.Mockito.*;

/**
Expand All @@ -58,6 +62,10 @@ public class FailedTest {
"file:src/test/resources/features/FailedScenario.feature\n"
+ ERROR_LOG_TEXT;

private static final Pair<String, String> SCENARIO_CODE_REFERENCES_WITH_ERROR = Pair.of("file:",
"src/test/resources/features/FailedScenario.feature\n" + ERROR_LOG_TEXT
);

@CucumberOptions(features = "src/test/resources/features/FailedScenario.feature", glue = {
"com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty",
"com.epam.reportportal.cucumber.integration.TestScenarioReporter" })
Expand Down Expand Up @@ -161,7 +169,6 @@ public void verify_failed_nested_step_description_scenario_reporter() {

FinishTestItemRQ step = finishRqs.get(0);
assertThat(step.getDescription(), not(equalTo(ERROR_LOG_TEXT)));
assertThat(step.getDescription(), not(equalTo(DESCRIPTION_ERROR_LOG_TEXT)));
}

@Test
Expand All @@ -182,6 +189,8 @@ public void verify_failed_step_description_step_reporter() {
FinishTestItemRQ step = finishRqs.get(0);
assertThat(step.getDescription(), equalTo(ERROR_LOG_TEXT));
FinishTestItemRQ test = finishRqs.get(1);
assertThat(test.getDescription(), equalTo(DESCRIPTION_ERROR_LOG_TEXT));
assertThat(test.getDescription(),
allOf(notNullValue(), startsWith(SCENARIO_CODE_REFERENCES_WITH_ERROR.getKey()), endsWith(SCENARIO_CODE_REFERENCES_WITH_ERROR.getValue()))
);
}
}

0 comments on commit 8de5405

Please sign in to comment.