use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class DisabledTestTest method verify_a_disabled_test_reason_reported.
@Test
public void verify_a_disabled_test_reason_reported() {
TestUtils.runClasses(OneDisabledTestWithReason.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());
List<StartTestItemRQ> steps = captorStart.getAllValues();
assertThat("StartTestItem request has proper Description field", captorStart.getAllValues().get(0).getDescription(), equalTo(OneDisabledTestWithReason.REASON));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class NestedStepTest method nestedTest.
@Test
public void nestedTest() {
TestUtils.runClasses(NestedStepFeaturePassedTest.class);
ArgumentCaptor<StartTestItemRQ> nestedStepCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
ArgumentCaptor<FinishTestItemRQ> finishNestedCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(CLIENT.get(), timeout(1000).times(1)).startTestItem(same(TEST_METHOD_ID), nestedStepCaptor.capture());
verify(CLIENT.get(), timeout(1000).times(1)).finishTestItem(same(STEP_ID_LIST.get(0)), finishNestedCaptor.capture());
StartTestItemRQ startTestItemRQ = nestedStepCaptor.getValue();
assertNotNull(startTestItemRQ);
assertFalse(startTestItemRQ.isHasStats());
assertEquals("I am nested step with parameter - '" + PARAM + "'", startTestItemRQ.getName());
FinishTestItemRQ finishNestedRQ = finishNestedCaptor.getValue();
assertNotNull(finishNestedRQ);
assertEquals("PASSED", finishNestedRQ.getStatus());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class NestedStepTest method failedNestedTest.
@Test
public void failedNestedTest() {
try {
TestUtils.runClasses(NestedStepFeatureFailedTest.class);
} catch (Exception ex) {
// to prevent this test failing
}
ArgumentCaptor<StartTestItemRQ> nestedStepCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
ArgumentCaptor<FinishTestItemRQ> finishNestedCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(CLIENT.get(), timeout(1000).times(1)).startTestItem(same(TEST_METHOD_ID), nestedStepCaptor.capture());
verify(CLIENT.get(), timeout(1000).times(1)).finishTestItem(same(STEP_ID_LIST.get(0)), finishNestedCaptor.capture());
StartTestItemRQ startTestItemRQ = nestedStepCaptor.getValue();
assertNotNull(startTestItemRQ);
assertFalse(startTestItemRQ.isHasStats());
assertEquals("I am nested step with parameter - '" + PARAM + "'", startTestItemRQ.getName());
FinishTestItemRQ finishNestedRQ = finishNestedCaptor.getValue();
assertNotNull(finishNestedRQ);
assertEquals("FAILED", finishNestedRQ.getStatus());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class NestedStepTest method nestedInBeforeMethodTest.
@Test
public void nestedInBeforeMethodTest() {
TestUtils.runClasses(NestedStepWithBeforeEachTest.class);
ArgumentCaptor<StartTestItemRQ> nestedStepCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
ArgumentCaptor<FinishTestItemRQ> finishNestedCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(CLIENT.get(), timeout(TimeUnit.SECONDS.toMillis(2)).times(1)).startTestItem(same(TEST_METHOD_ID), nestedStepCaptor.capture());
verify(CLIENT.get(), timeout(TimeUnit.SECONDS.toMillis(2)).times(1)).finishTestItem(same(STEP_ID_LIST.get(0)), finishNestedCaptor.capture());
StartTestItemRQ startTestItemRQ = nestedStepCaptor.getValue();
assertNotNull(startTestItemRQ);
assertFalse(startTestItemRQ.isHasStats());
assertEquals("I am nested step with parameter - '" + PARAM + "'", startTestItemRQ.getName());
FinishTestItemRQ finishNestedRQ = finishNestedCaptor.getValue();
assertNotNull(finishNestedRQ);
assertEquals("PASSED", finishNestedRQ.getStatus());
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class AttributesTest method verify_method_level_attributes.
@Test
public void verify_method_level_attributes() {
TestUtils.runClasses(MethodLevelAttributesTest.class);
Launch launch = AttributesTestExtension.LAUNCH;
ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test
verify(launch).startTestItem(captor.capture());
// Start step
verify(launch).startTestItem(any(), captor.capture());
StartTestItemRQ testRequest = extractRequest(captor, "suite");
assertThat(testRequest.getAttributes(), anyOf(nullValue(), emptyIterable()));
StartTestItemRQ stepRequest = extractRequest(captor, "step");
assertThat(stepRequest.getAttributes(), hasSize(1));
ItemAttributesRQ attribute = stepRequest.getAttributes().iterator().next();
assertThat(attribute.getKey(), equalTo("myKey"));
assertThat(attribute.getValue(), equalTo("myValue"));
}
Aggregations