use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project agent-java-testNG by reportportal.
the class TestNGService 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.setName(parameters.getLaunchName());
rq.setStartTime(Calendar.getInstance().getTime());
Set<ItemAttributesRQ> attributes = new HashSet<>(parameters.getAttributes());
rq.setAttributes(attributes);
rq.setMode(parameters.getLaunchRunningMode());
rq.setRerun(parameters.isRerun());
if (isNotBlank(parameters.getRerunOf())) {
rq.setRerunOf(parameters.getRerunOf());
}
if (isNotBlank(parameters.getDescription())) {
rq.setDescription(parameters.getDescription());
}
if (null != parameters.getSkippedAnIssue()) {
ItemAttributesRQ skippedIssueAttribute = new ItemAttributesRQ();
skippedIssueAttribute.setKey(SKIPPED_ISSUE_KEY);
skippedIssueAttribute.setValue(parameters.getSkippedAnIssue().toString());
skippedIssueAttribute.setSystem(true);
attributes.add(skippedIssueAttribute);
}
attributes.addAll(SystemAttributesExtractor.extract(AGENT_PROPERTIES_FILE, TestNGService.class.getClassLoader()));
return rq;
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project agent-java-testNG by reportportal.
the class AttributeTest method verify_class_level_attributes_bypass.
@Test
public void verify_class_level_attributes_bypass() {
TestUtils.runTests(Collections.singletonList(TestReportPortalListener.class), ClassLevelAttributesTest.class);
// Start parent suite
verify(launch).startTestItem(any());
ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
// Start test and step
verify(launch, times(2)).startTestItem(any(), captor.capture());
StartTestItemRQ testRequest = extractRequest(captor, "test");
assertThat(testRequest.getAttributes(), hasSize(1));
ItemAttributesRQ attribute = testRequest.getAttributes().iterator().next();
assertThat(attribute.getKey(), equalTo(ClassLevelAttributesTest.KEY));
assertThat(attribute.getValue(), equalTo(ClassLevelAttributesTest.VALUE));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project agent-java-testNG by reportportal.
the class BuildTestTest method testSkippedIssue.
@Test
public void testSkippedIssue() {
ItemAttributesRQ itemAttributeResource = new ItemAttributesRQ();
itemAttributeResource.setKey(SKIPPED_ISSUE_KEY);
itemAttributeResource.setValue(String.valueOf(true));
itemAttributeResource.setSystem(true);
ListenerParameters parameters = new ListenerParameters();
parameters.setSkippedAnIssue(true);
parameters.setAttributes(new HashSet<>());
StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(parameters);
assertTrue(startLaunchRQ.getAttributes().contains(itemAttributeResource));
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project examples-java by reportportal.
the class SaucelabsIntegrationTest method sendFinishRequest.
private void sendFinishRequest(TestItemTree.TestItemLeaf testResultLeaf, String sauceLabsJobId) {
FinishTestItemRQ finishTestItemRQ = new FinishTestItemRQ();
finishTestItemRQ.setStatus("PASSED");
finishTestItemRQ.setEndTime(Calendar.getInstance().getTime());
finishTestItemRQ.setAttributes(Sets.newHashSet(new ItemAttributesRQ("SLID", sauceLabsJobId)));
ItemTreeReporter.finishItem(TestNGService.getReportPortal().getClient(), finishTestItemRQ, ITEM_TREE.getLaunchId(), testResultLeaf).cache().blockingGet();
}
use of com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ in project service-api by reportportal.
the class LaunchControllerTest method happyCreateLaunch.
@Test
void happyCreateLaunch() throws Exception {
String name = "some launch name";
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setDescription("some description");
startLaunchRQ.setName(name);
startLaunchRQ.setStartTime(new Date());
startLaunchRQ.setMode(DEFAULT);
startLaunchRQ.setAttributes(Sets.newHashSet(new ItemAttributesRQ("key", "value")));
mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + "/launch/").with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(startLaunchRQ)).contentType(APPLICATION_JSON)).andExpect(status().isCreated());
}
Aggregations