use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.
the class BuildStepTest method testType.
@Test
public void testType() {
when(testResult.getMethod()).thenReturn(testNGMethod);
when(testNGMethod.getConstructorOrMethod()).thenReturn(constructorOrMethod);
when(testNGMethod.isTest()).thenReturn(true);
StartTestItemRQ rq = testNGService.buildStartStepRq(testResult);
assertThat("Incorrect test item type", rq.getType(), is("STEP"));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-testNG by reportportal.
the class NestedStepTest method nestedTest.
@Test
public void nestedTest() {
mockNestedSteps(client, testStepIdOrder.get(0));
TestUtils.runTests(singletonList(TestNgListener.class), NestedStepFeaturePassedTest.class);
ArgumentCaptor<StartTestItemRQ> nestedStepCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
ArgumentCaptor<FinishTestItemRQ> finishNestedCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(client, timeout(1000).times(1)).startTestItem(same(testMethodId), nestedStepCaptor.capture());
verify(client, timeout(1000).times(1)).finishTestItem(same(stepIdList.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-testNG by reportportal.
the class NestedStepTest method failedNestedTest.
@Test
public void failedNestedTest() {
mockNestedSteps(client, testStepIdOrder.get(0));
try {
TestUtils.runTests(singletonList(TestNgListener.class), 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, timeout(1000).times(1)).startTestItem(same(testMethodId), nestedStepCaptor.capture());
verify(client, timeout(1000).times(1)).finishTestItem(same(stepIdList.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-testNG by reportportal.
the class NestedStepTest method nestedInBeforeMethodTest.
@Test
public void nestedInBeforeMethodTest() {
mockNestedSteps(client, testStepIdOrder.get(0));
TestUtils.runTests(singletonList(TestNgListener.class), NestedStepWithBeforeEachTest.class);
ArgumentCaptor<StartTestItemRQ> nestedStepCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
ArgumentCaptor<FinishTestItemRQ> finishNestedCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(client, timeout(1000).times(1)).startTestItem(same(testMethodId), nestedStepCaptor.capture());
verify(client, timeout(1000).times(1)).finishTestItem(same(stepIdList.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-testNG by reportportal.
the class NestedStepTest method testWithMultiLevelNested.
@Test
public void testWithMultiLevelNested() throws NoSuchMethodException {
mockNestedSteps(client, testStepIdOrder);
TestUtils.runTests(singletonList(TestNgListener.class), NestedStepMultiLevelTest.class);
ArgumentCaptor<StartTestItemRQ> nestedStepCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
ArgumentCaptor<FinishTestItemRQ> finishNestedCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(client, timeout(1000).times(1)).startTestItem(same(testMethodId), nestedStepCaptor.capture());
verify(client, timeout(1000).times(1)).finishTestItem(same(stepIdList.get(0)), finishNestedCaptor.capture());
verify(client, timeout(1000).times(1)).startTestItem(same(stepIdList.get(0)), nestedStepCaptor.capture());
verify(client, timeout(1000).times(1)).finishTestItem(same(stepIdList.get(1)), finishNestedCaptor.capture());
List<StartTestItemRQ> nestedSteps = nestedStepCaptor.getAllValues();
nestedSteps.forEach(step -> {
assertNotNull(step);
assertFalse(step.isHasStats());
});
StartTestItemRQ stepWithInnerStep = nestedSteps.get(0);
assertEquals(METHOD_WITH_INNER_METHOD_NAME_TEMPLATE, stepWithInnerStep.getName());
StartTestItemRQ innerStep = nestedSteps.get(1);
assertEquals("I am - " + NestedStepMultiLevelTest.class.getDeclaredMethod("innerMethod").getName(), innerStep.getName());
}
Aggregations