Search in sources :

Example 26 with Launch

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));
}
Also used : Maybe(io.reactivex.Maybe) Launch(com.epam.reportportal.service.Launch) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) JunitDynamicNestedTest(com.epam.reportportal.junit5.features.nested.JunitDynamicNestedTest) Test(org.junit.jupiter.api.Test)

Example 27 with Launch

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()));
}
Also used : Launch(com.epam.reportportal.service.Launch) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) OneDisabledOneEnabledTest(com.epam.reportportal.junit5.features.disabled.OneDisabledOneEnabledTest) OneDisabledTest(com.epam.reportportal.junit5.features.disabled.OneDisabledTest)

Example 28 with Launch

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()));
}
Also used : Launch(com.epam.reportportal.service.Launch) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) OneDisabledOneEnabledTest(com.epam.reportportal.junit5.features.disabled.OneDisabledOneEnabledTest) OneDisabledTest(com.epam.reportportal.junit5.features.disabled.OneDisabledTest)

Example 29 with Launch

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));
}
Also used : Launch(com.epam.reportportal.service.Launch) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 30 with Launch

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));
}
Also used : Launch(com.epam.reportportal.service.Launch) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Aggregations

Launch (com.epam.reportportal.service.Launch)33 StartTestItemRQ (com.epam.ta.reportportal.ws.model.StartTestItemRQ)22 Test (org.junit.jupiter.api.Test)18 Maybe (io.reactivex.Maybe)9 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)8 SingleTest (com.epam.reportportal.junit5.features.coderef.SingleTest)5 ListenerParameters (com.epam.reportportal.listeners.ListenerParameters)5 Collectors (java.util.stream.Collectors)5 CommonUtils (com.epam.reportportal.util.test.CommonUtils)4 ItemAttributesRQ (com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)4 StartLaunchRQ (com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)4 OneDisabledOneEnabledTest (com.epam.reportportal.junit5.features.disabled.OneDisabledOneEnabledTest)3 OneDisabledTest (com.epam.reportportal.junit5.features.disabled.OneDisabledTest)3 JunitDynamicNestedTest (com.epam.reportportal.junit5.features.nested.JunitDynamicNestedTest)3 AssumptionFailedTest (com.epam.reportportal.junit5.features.skipped.AssumptionFailedTest)3 BeforeEachAssumptionFailedTest (com.epam.reportportal.junit5.features.skipped.BeforeEachAssumptionFailedTest)3 ItemStatus (com.epam.reportportal.listeners.ItemStatus)3 ReportPortal (com.epam.reportportal.service.ReportPortal)3 ArgumentCaptor (org.mockito.ArgumentCaptor)3 Answer (org.mockito.stubbing.Answer)3