use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class XunitImportHandler method startRootItem.
private void startRootItem(String name, String timestamp) {
if (null != timestamp) {
startItemTime = parseTimeStamp(timestamp);
if (startSuiteTime.isAfter(startItemTime)) {
startSuiteTime = LocalDateTime.of(startItemTime.toLocalDate(), startItemTime.toLocalTime());
}
} else {
startItemTime = LocalDateTime.now();
}
StartTestItemRQ rq = buildStartTestRq(name);
String id = startTestItemHandler.startRootItem(user, projectDetails, rq).getId();
itemUuids.push(id);
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project service-api by reportportal.
the class XunitImportHandler method startTestItem.
private void startTestItem(String name) {
StartTestItemRQ rq = buildStartTestRq(name);
String id = startTestItemHandler.startChildItem(user, projectDetails, rq, itemUuids.peek()).getId();
itemUuids.push(id);
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class FailedBeforeEachReportsSkippedTestTest method agent_should_not_report_skipped_test_in_case_of_failed_after_each.
@Test
public void agent_should_not_report_skipped_test_in_case_of_failed_after_each() {
TestUtils.runClasses(AfterEachFailedTest.class);
Pair<List<Pair<String, StartTestItemRQ>>, Map<String, FinishTestItemRQ>> calls = verify_call_number_and_capture_arguments(4, LAUNCH);
verifyNoMoreInteractions(LAUNCH);
assertThat("There are 4 item created: suite, @BeforeEach, @Test and @AfterEach", ITEMS, hasSize(4));
FinishTestItemRQ beforeEachFinish = calls.getValue().get(ITEMS.get(1));
assertThat("@BeforeEach passed", beforeEachFinish.getStatus(), equalTo("PASSED"));
FinishTestItemRQ testFinish = calls.getValue().get(ITEMS.get(2));
assertThat("@Test passed", testFinish.getStatus(), equalTo("PASSED"));
FinishTestItemRQ afterEachFinish = calls.getValue().get(ITEMS.get(3));
assertThat("@AfterEach failed", afterEachFinish.getStatus(), equalTo("FAILED"));
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class FailedBeforeEachReportsSkippedTestTest method agent_should_report_skipped_parametrized_tests_in_case_of_failed_before_each.
@Test
public void agent_should_report_skipped_parametrized_tests_in_case_of_failed_before_each() {
TestUtils.runClasses(BeforeEachFailedParametrizedTest.class);
Pair<List<Pair<String, StartTestItemRQ>>, Map<String, FinishTestItemRQ>> calls = verify_call_number_and_capture_arguments(6, 1, LAUNCH);
verifyNoMoreInteractions(LAUNCH);
assertThat("There are 6 item created: parent suite, suite, 2 @BeforeEach, @Test 1 and @Test 2", ITEMS, hasSize(6));
FinishTestItemRQ beforeEachFinish = calls.getValue().get(ITEMS.get(2));
assertThat("@BeforeEach failed", beforeEachFinish.getStatus(), equalTo("FAILED"));
Date currentDate = new Date();
IntStream.rangeClosed(0, 1).boxed().forEach(i -> {
StartTestItemRQ testStart = calls.getKey().get(3 + (i * 2)).getValue();
assertThat("@Test has correct code reference", testStart.getCodeRef(), equalTo(BeforeEachFailedParametrizedTest.class.getCanonicalName() + ".testBeforeEachFailed"));
assertThat("@Test has correct name", testStart.getName(), equalTo("[" + (i + 1) + "] " + BeforeEachFailedParametrizedTest.TestParams.values()[i]));
FinishTestItemRQ testFinish = calls.getValue().get(ITEMS.get(3 + (i * 2)));
assertThat("@Test reported as skipped", testFinish.getStatus(), equalTo(ItemStatus.SKIPPED.name()));
assertThat("@Test issue muted", testFinish.getIssue(), sameInstance(Launch.NOT_ISSUE));
assertThat(testFinish.getEndTime(), lessThanOrEqualTo(currentDate));
});
}
use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project agent-java-junit5 by reportportal.
the class JunitNestedTestTest method verify_dynamically_generated_nested_tests.
@Test
@SuppressWarnings("unchecked")
public void verify_dynamically_generated_nested_tests() {
TestUtils.runClasses(JunitDynamicNestedTest.class);
Launch launch = TestExtension.LAUNCH;
ArgumentCaptor<StartTestItemRQ> suiteCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start parent Suite
verify(launch, times(1)).startTestItem(suiteCaptor.capture());
ArgumentCaptor<Maybe<String>> parentIdCaptor = ArgumentCaptor.forClass(Maybe.class);
ArgumentCaptor<StartTestItemRQ> itemRqCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start inner items
verify(launch, times(9)).startTestItem(parentIdCaptor.capture(), itemRqCaptor.capture());
verify(launch, times(10)).finishTestItem(any(Maybe.class), any(FinishTestItemRQ.class));
List<Maybe<String>> parentIds = parentIdCaptor.getAllValues();
List<StartTestItemRQ> itemRqs = itemRqCaptor.getAllValues();
int index = 0;
String parentId = parentIds.get(index).blockingGet();
StartTestItemRQ itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-JunitDynamicNestedTest-"));
assertThat(itemRq.getName(), equalTo("dynamicTestsWithContainers()"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-dynamicTestsWithContainers()-"));
assertThat(itemRq.getName(), equalTo("A"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-A-"));
assertThat(itemRq.getName(), equalTo("A inner container"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-A inner container-"));
assertThat(itemRq.getName(), equalTo("A Test 1"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-A inner container-"));
assertThat(itemRq.getName(), equalTo("A Test 2"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-dynamicTestsWithContainers()-"));
assertThat(itemRq.getName(), equalTo("B"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-B"));
assertThat(itemRq.getName(), equalTo("B inner container"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-B inner container-"));
assertThat(itemRq.getName(), equalTo("B Test 1"));
parentId = parentIds.get(++index).blockingGet();
itemRq = itemRqs.get(index);
assertThat(parentId, Matchers.startsWith("suite-B inner container-"));
assertThat(itemRq.getName(), equalTo("B Test 2"));
}
Aggregations