use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class AllureIdAnnotationTest method test_allure_id_with_params.
@Test
public void test_allure_id_with_params() {
runTests(Collections.singletonList(TestNgListener.class), TestAllureIdParams.class);
// Start launch
verify(client).startLaunch(any());
// Start parent suites
verify(client).startTestItem(any());
// Start test class
verify(client).startTestItem(same(suitedUuid), any());
ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test step
verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
StartTestItemRQ startMethod = startMethodCapture.getValue();
Set<ItemAttributesRQ> attributes = startMethod.getAttributes();
List<ItemAttributesRQ> idAttributes = attributes.stream().filter(a -> "AS_ID".equals(a.getKey())).collect(Collectors.toList());
assertThat(idAttributes, hasSize(1));
ItemAttributesRQ id = idAttributes.get(0);
assertThat(id.getValue(), equalTo("My ID"));
assertThat(startMethod.getTestCaseId(), equalTo("My ID[Data step name]"));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class FlakyAnnotationTest method test_flaky_annotation_method_level_processing.
@Test
public void test_flaky_annotation_method_level_processing() {
runTests(Collections.singletonList(TestNgListener.class), TestFlakyMethodLevel.class);
// Start launch
verify(client).startLaunch(any());
// Start parent suites
verify(client).startTestItem(any());
// Start test class
verify(client).startTestItem(same(suitedUuid), any());
ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test step
verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
StartTestItemRQ startMethod = startMethodCapture.getValue();
Set<ItemAttributesRQ> attributes = startMethod.getAttributes();
List<ItemAttributesRQ> flakyAttributes = attributes.stream().filter(a -> "flaky".equals(a.getValue())).collect(Collectors.toList());
assertThat(flakyAttributes, hasSize(1));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class FlakyAnnotationTest method test_flaky_annotation_class_level_processing.
@Test
public void test_flaky_annotation_class_level_processing() {
runTests(Collections.singletonList(TestNgListener.class), TestFlakyClassLevel.class);
// Start launch
verify(client).startLaunch(any());
// Start parent suites
verify(client).startTestItem(any());
// Start test class
verify(client).startTestItem(same(suitedUuid), any());
ArgumentCaptor<StartTestItemRQ> startMethodCapture = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test step
verify(client).startTestItem(same(testClassUuid), startMethodCapture.capture());
StartTestItemRQ startMethod = startMethodCapture.getValue();
Set<ItemAttributesRQ> attributes = startMethod.getAttributes();
List<ItemAttributesRQ> flakyAttributes = attributes.stream().filter(a -> "flaky".equals(a.getValue())).collect(Collectors.toList());
assertThat(flakyAttributes, hasSize(1));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class AnnotationUtils method processPriority.
public static void processPriority(@Nonnull StartTestItemRQ rq, @Nullable Method source) {
ofNullable(source).ifPresent(s -> {
Severity annotation = ofNullable(s.getAnnotation(Severity.class)).orElseGet(() -> source.getDeclaringClass().getAnnotation(Severity.class));
if (annotation != null) {
// Allure don't know the difference between priority and severity (-‸ლ)
ItemAttributesRQ attribute = new ItemAttributesRQ("priority", annotation.value().value());
Set<ItemAttributesRQ> attributes = retrieveAttributes(rq);
attributes.add(attribute);
}
});
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project service-api by reportportal.
the class RerunHandlerImplTest method happyRerunLaunch.
@Test
void happyRerunLaunch() {
StartLaunchRQ request = new StartLaunchRQ();
String launchName = "launch";
long projectId = 1L;
request.setRerun(true);
request.setName(launchName);
request.setMode(Mode.DEFAULT);
request.setDescription("desc");
request.setAttributes(Sets.newHashSet(new ItemAttributesRQ("test", "test")));
ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId);
when(launchRepository.findLatestByNameAndProjectId("launch", projectId)).thenReturn(Optional.of(getLaunch("uuid")));
final Launch launch = rerunHandler.handleLaunch(request, projectId, rpUser);
assertNotNull(launch.getNumber());
assertNotNull(launch.getId());
}
Aggregations