use of com.epam.reportportal.junit5.ItemType in project agent-java-junit5 by reportportal.
the class ReportPortalExtension method buildStartStepRq.
/**
* Extension point to customize test step creation event/request
*
* @param context JUnit's test context
* @param arguments a test arguments list
* @param itemType a test method item type
* @param description a test method description
* @param startTime a start time of the test
* @return Request to ReportPortal
*/
@Nonnull
protected StartTestItemRQ buildStartStepRq(@Nonnull final ExtensionContext context, @Nonnull final List<Object> arguments, @Nonnull final ItemType itemType, @Nonnull final String description, @Nonnull final Date startTime) {
StartTestItemRQ rq = new StartTestItemRQ();
rq.setStartTime(startTime);
rq.setName(createStepName(context));
rq.setDescription(description);
rq.setUniqueId(context.getUniqueId());
rq.setType(itemType == TEMPLATE ? SUITE.name() : itemType.name());
String codeRef = getCodeRef(context);
rq.setCodeRef(codeRef);
rq.setAttributes(context.getTags().stream().map(it -> new ItemAttributesRQ(null, it)).collect(Collectors.toSet()));
if (SUITE == itemType) {
context.getTestClass().ifPresent(c -> rq.getAttributes().addAll(getAttributes(c)));
}
Optional<Method> testMethod = getTestMethod(context);
TestCaseIdEntry caseId = testMethod.map(m -> {
rq.getAttributes().addAll(getAttributes(m));
rq.setParameters(getParameters(m, arguments));
return getTestCaseId(m, codeRef, arguments, context.getTestInstance().orElse(null));
}).orElseGet(() -> TestCaseIdUtils.getTestCaseId(codeRef, arguments));
rq.setTestCaseId(ofNullable(caseId).map(TestCaseIdEntry::getId).orElse(null));
return rq;
}
Aggregations