use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class JunitNestedTestTest method verify_static_nested_tests_long_depth.
@Test
@SuppressWarnings("unchecked")
public void verify_static_nested_tests_long_depth() {
TestUtils.runClasses(JunitClassNestedTestsLongDepth.class);
Launch launch = TestExtension.LAUNCH;
verify(launch, times(1)).startTestItem(any(StartTestItemRQ.class));
verify(launch, times(11)).startTestItem(any(Maybe.class), any(StartTestItemRQ.class));
verify(launch, times(12)).finishTestItem(any(Maybe.class), any(FinishTestItemRQ.class));
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class DisabledTestTest method verify_a_disabled_test_does_not_affect_enabled_in_the_same_class.
@Test
public void verify_a_disabled_test_does_not_affect_enabled_in_the_same_class() {
TestUtils.runClasses(OneDisabledOneEnabledTest.class);
Launch launch = DisabledTestExtension.LAUNCH;
// Start parent Suite
verify(launch, times(1)).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captorStart = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start a disabled test and an enabled one
verify(launch, times(2)).startTestItem(notNull(), captorStart.capture());
ArgumentCaptor<FinishTestItemRQ> captorFinish = ArgumentCaptor.forClass(FinishTestItemRQ.class);
// finish two tests and a suite
verify(launch, times(3)).finishTestItem(notNull(), captorFinish.capture());
List<StartTestItemRQ> steps = captorStart.getAllValues();
assertThat("There two StartTestItem request", steps, hasSize(2));
assertThat("StartTestItem request for enabled test has proper Name field", steps.get(1).getName(), equalTo(OneDisabledOneEnabledTest.DISPLAY_NAME));
List<FinishTestItemRQ> finishes = captorFinish.getAllValues();
assertThat("There are two finish tests and a finish suite requests", finishes, hasSize(3));
FinishTestItemRQ finishStep = finishes.get(0);
assertThat("Disabled test has skipped status", finishStep.getStatus(), equalTo(ItemStatus.SKIPPED.name()));
finishStep = finishes.get(1);
assertThat("Enabled has passed status", finishStep.getStatus(), equalTo(ItemStatus.PASSED.name()));
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class DisabledTestTest method verify_a_disabled_test_reported_as_skipped.
@Test
public void verify_a_disabled_test_reported_as_skipped() {
TestUtils.runClasses(OneDisabledTest.class);
Launch launch = DisabledTestExtension.LAUNCH;
// Start parent Suite
verify(launch, times(1)).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captorStart = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start a test
verify(launch, times(1)).startTestItem(notNull(), captorStart.capture());
ArgumentCaptor<FinishTestItemRQ> captorFinish = ArgumentCaptor.forClass(FinishTestItemRQ.class);
// finish a test and a suite
verify(launch, times(2)).finishTestItem(notNull(), captorFinish.capture());
List<StartTestItemRQ> steps = captorStart.getAllValues();
assertThat("There is only one StartTestItem request", steps, hasSize(1));
assertThat("StartTestItem request has proper Description field", steps.get(0).getDescription(), equalTo("void " + OneDisabledTest.class.getCanonicalName() + ".disabledTest() is @Disabled"));
List<FinishTestItemRQ> finishes = captorFinish.getAllValues();
assertThat("There are only finish test and finish suite requests", finishes, hasSize(2));
FinishTestItemRQ finishStep = finishes.get(0);
assertThat("Finish item has skipped status", finishStep.getStatus(), equalTo(ItemStatus.SKIPPED.name()));
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class TestCaseIdTest method singleDynamicTest.
@Test
void singleDynamicTest() {
TestUtils.runClasses(SingleDynamicTest.class);
Launch launch = TestCaseIdExtension.LAUNCH;
// Start parent Suite
verify(launch, times(1)).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start a test
verify(launch, times(2)).startTestItem(notNull(), captor.capture());
List<StartTestItemRQ> requests = captor.getAllValues();
String testName = SingleDynamicTest.class.getCanonicalName() + ".testForTestFactory";
assertThat(requests.get(0).getTestCaseId(), equalTo(testName));
assertThat(requests.get(1).getTestCaseId(), equalTo(testName + "$" + SingleDynamicTest.TEST_CASE_DISPLAY_NAME));
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class TestCaseIdTest method singleDynamicAnnotatedTest.
@Test
void singleDynamicAnnotatedTest() {
TestUtils.runClasses(SingleDynamicAnnotatedTest.class);
Launch launch = TestCaseIdExtension.LAUNCH;
// Start parent Suite
verify(launch, times(1)).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start a test
verify(launch, times(2)).startTestItem(notNull(), captor.capture());
assertThat(captor.getAllValues().stream().map(StartTestItemRQ::getTestCaseId).collect(Collectors.toList()), hasItem(SingleDynamicAnnotatedTest.TEST_CASE_ID_VALUE));
}
Aggregations