use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project agent-java-junit5 by reportportal.
the class ReportPortalExtension method buildStartLaunchRq.
/**
* Extension point to customize launch creation event/request
*
* @param parameters Launch Configuration parameters
* @return Request to ReportPortal
*/
protected StartLaunchRQ buildStartLaunchRq(ListenerParameters parameters) {
StartLaunchRQ rq = new StartLaunchRQ();
rq.setMode(parameters.getLaunchRunningMode());
rq.setDescription(parameters.getDescription());
rq.setName(parameters.getLaunchName());
Set<ItemAttributesRQ> attributes = new HashSet<>(parameters.getAttributes());
attributes.addAll(collectSystemAttributes(parameters.getSkippedAnIssue()));
rq.setAttributes(attributes);
rq.setStartTime(Calendar.getInstance().getTime());
rq.setRerun(parameters.isRerun());
rq.setRerunOf(StringUtils.isEmpty(parameters.getRerunOf()) ? null : parameters.getRerunOf());
return rq;
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ 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"));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class RuntimeUpdatesTest method test_attribute_add.
@Test
public void test_attribute_add() {
mockLogging(client);
TestNG result = runTests(TestAttributeAdd.class);
assertThat(result.getStatus(), equalTo(0));
ArgumentCaptor<FinishTestItemRQ> finishCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
verify(client).finishTestItem(same(stepUuid), finishCaptor.capture());
FinishTestItemRQ finishItemRequest = finishCaptor.getValue();
assertThat(finishItemRequest.getAttributes(), hasSize(1));
ItemAttributesRQ attribute = finishItemRequest.getAttributes().iterator().next();
assertThat(attribute.getKey(), equalTo("epic"));
assertThat(attribute.getValue(), equalTo(TestAttributeAdd.EPIC));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class AllureIdAnnotationTest method test_allure_id_test_case_id_override.
@Test
public void test_allure_id_test_case_id_override() {
runTests(Collections.singletonList(TestNgListener.class), TestAllureIdTestCaseIdOverride.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 Test Case ID"));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project allure-java by reportportal.
the class AllureIdAnnotationTest method test_allure_id_no_params.
@Test
public void test_allure_id_no_params() {
runTests(Collections.singletonList(TestNgListener.class), TestAllureIdNoParams.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 no params ID"));
assertThat(startMethod.getTestCaseId(), equalTo("My no params ID"));
}
Aggregations