use of com.epam.reportportal.service.Launch in project agent-java-testNG by reportportal.
the class TestNGService method startConfiguration.
@Override
public void startConfiguration(ITestResult testResult) {
TestMethodType type = TestMethodType.getStepType(testResult.getMethod());
testResult.setAttribute(RP_METHOD_TYPE, type);
StartTestItemRQ rq = buildStartConfigurationRq(testResult, type);
if (Boolean.TRUE == rq.isRetry()) {
testResult.setAttribute(RP_RETRY, Boolean.TRUE);
}
Maybe<String> parentId = getConfigParent(testResult, type);
Launch myLaunch = launch.get();
Maybe<String> itemID = myLaunch.startTestItem(parentId, rq);
testResult.setAttribute(RP_ID, itemID);
}
use of com.epam.reportportal.service.Launch in project agent-java-testNG by reportportal.
the class TestCaseIdTest method testCaseIdFromCodeRefAndParams.
@Test
public void testCaseIdFromCodeRefAndParams() {
TestUtils.runTests(Collections.singletonList(TestReportPortalListener.class), TestCaseIdFromCodeRefAndParams.class);
String expectedCodeRef = TestCaseIdFromCodeRefAndParams.class.getCanonicalName() + "." + TestCaseIdFromCodeReference.STEP_NAME;
List<String> expectedTestCaseIds = Stream.of("one", "two", "three").map(it -> expectedCodeRef + "[" + it + "]").collect(Collectors.toList());
// Start parent suites
verify(launch, times(1)).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test and steps
verify(launch, times(4)).startTestItem(any(), captor.capture());
StartTestItemRQ testRequest = extractRequest(captor, "test");
List<String> actualTestCaseIds = extractRequests(captor, "step").stream().map(StartTestItemRQ::getTestCaseId).collect(Collectors.toList());
assertThat(testRequest.getName(), equalTo(TestUtils.TEST_NAME));
assertThat(actualTestCaseIds, equalTo(expectedTestCaseIds));
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class AssumptionsTest method verify_assumption_failure_marks_test_as_skipped.
@Test
public void verify_assumption_failure_marks_test_as_skipped() {
TestUtils.runClasses(AssumptionFailedTest.class);
Launch launch = AssumptionsTestExtension.LAUNCH;
// Start parent Suite
verify(launch).startTestItem(any(StartTestItemRQ.class));
// Start a test
verify(launch, times(1)).startTestItem(notNull(), any(StartTestItemRQ.class));
ArgumentCaptor<FinishTestItemRQ> finishCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(launch, times(2)).finishTestItem(any(), finishCaptor.capture());
List<FinishTestItemRQ> finishItems = finishCaptor.getAllValues();
assertThat(finishItems.get(0).getStatus(), equalTo(ItemStatus.SKIPPED.name()));
assertThat(finishItems.get(1).getStatus(), nullValue());
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class AttributesTest method verify_class_level_attributes.
@Test
public void verify_class_level_attributes() {
TestUtils.runClasses(ClassLevelAttributesTest.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(), hasSize(1));
ItemAttributesRQ attribute = testRequest.getAttributes().iterator().next();
assertThat(attribute.getKey(), equalTo(ClassLevelAttributesTest.KEY));
assertThat(attribute.getValue(), equalTo(ClassLevelAttributesTest.VALUE));
StartTestItemRQ stepRequest = extractRequest(captor, "step");
assertThat(stepRequest.getAttributes(), anyOf(nullValue(), emptyIterable()));
}
use of com.epam.reportportal.service.Launch in project agent-java-junit5 by reportportal.
the class CodeReferenceTest method verify_dynamic_test_code_reference_generation.
@Test
public void verify_dynamic_test_code_reference_generation() {
TestUtils.runClasses(SingleDynamicTest.class);
Launch launch = CodeReferenceTestExtension.LAUNCH;
ArgumentCaptor<StartTestItemRQ> suiteCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start parent Suite
verify(launch, times(1)).startTestItem(suiteCaptor.capture());
ArgumentCaptor<StartTestItemRQ> testCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start a test class and a test
verify(launch, times(2)).startTestItem(notNull(), testCaptor.capture());
String className = SingleDynamicTest.class.getCanonicalName();
StartTestItemRQ suiteRq = suiteCaptor.getValue();
assertThat(suiteRq.getCodeRef(), equalTo(className));
List<StartTestItemRQ> rqValues = testCaptor.getAllValues();
String testName = className + ".testForTestFactory";
assertThat(rqValues.get(0).getCodeRef(), equalTo(testName));
assertThat(rqValues.get(1).getCodeRef(), equalTo(testName + "$" + SingleDynamicTest.TEST_CASE_DISPLAY_NAME));
}
Aggregations