Search in sources :

Example 11 with ReportPortal

use of com.epam.reportportal.service.ReportPortal in project allure-java by reportportal.

the class AttachmentsTest method initMocks.

@BeforeEach
public void initMocks() {
    mockLaunch(client, launchUuid, suitedUuid, testClassUuid, stepUuid);
    mockLogging(client);
    ReportPortal reportPortal = ReportPortal.create(client, standardParameters(), executor);
    TestNgListener.REPORT_PORTAL_THREAD_LOCAL.set(reportPortal);
}
Also used : ReportPortal(com.epam.reportportal.service.ReportPortal) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 12 with ReportPortal

use of com.epam.reportportal.service.ReportPortal in project allure-java by reportportal.

the class FlakyAnnotationTest method initMocks.

@BeforeEach
public void initMocks() {
    mockLaunch(client, namedUuid("launchUuid"), suitedUuid, testClassUuid, stepUuid);
    ReportPortal reportPortal = ReportPortal.create(client, standardParameters());
    TestNgListener.REPORT_PORTAL_THREAD_LOCAL.set(reportPortal);
}
Also used : ReportPortal(com.epam.reportportal.service.ReportPortal) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with ReportPortal

use of com.epam.reportportal.service.ReportPortal in project seleniumRobot by bhecquet.

the class ReportPortalService method getLaunchOverriddenProperties.

private static Supplier<Launch> getLaunchOverriddenProperties() {
    ListenerParameters parameters = new ListenerParameters(PropertiesLoader.load());
    parameters.setCallbackReportingEnabled(true);
    ReportPortal reportPortal = ReportPortal.builder().withParameters(parameters).build();
    StartLaunchRQ rq = buildStartLaunch(reportPortal.getParameters());
    rpLaunch = reportPortal.newLaunch(rq);
    return () -> rpLaunch;
}
Also used : StartLaunchRQ(com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ) ListenerParameters(com.epam.reportportal.listeners.ListenerParameters) ReportPortal(com.epam.reportportal.service.ReportPortal)

Example 14 with ReportPortal

use of com.epam.reportportal.service.ReportPortal in project vividus by vividus-framework.

the class AdaptedDelegatingReportPortalStoryReporterTests method shouldSendStacktraceToTheReportPortal.

@Test
void shouldSendStacktraceToTheReportPortal() {
    var event = mock(AssertionFailedEvent.class);
    var softAssertionError = mock(SoftAssertionError.class);
    when(event.getSoftAssertionError()).thenReturn(softAssertionError);
    when(softAssertionError.getError()).thenReturn(new AssertionError());
    var failedStep = mock(TestItemLeaf.class);
    when(reporter.getLastStep()).thenReturn(Optional.of(failedStep));
    var id = "id";
    var just = Maybe.just(id);
    when(failedStep.getItemId()).thenReturn(just);
    try (MockedStatic<ReportPortal> reportPortal = Mockito.mockStatic(ReportPortal.class)) {
        adaptedReporter.onAssertionFailure(event);
        reportPortal.verify(() -> ReportPortal.emitLog(eq(just), argThat(f -> {
            SaveLogRQ saveLogRQ = f.apply(id);
            Assertions.assertAll(() -> assertEquals(id, saveLogRQ.getItemUuid()), () -> assertEquals("ERROR", saveLogRQ.getLevel()), () -> assertTrue(saveLogRQ.getLogTime().getTime() <= LocalDateTime.now().toInstant(ZoneOffset.UTC).toEpochMilli()), () -> assertTrue(saveLogRQ.getMessage().matches("(?s)java.lang.AssertionError.+(.+\\.java.+)+.+")));
            return true;
        })));
    }
}
Also used : SoftAssertionError(org.vividus.softassert.model.SoftAssertionError) SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ) ReportPortal(com.epam.reportportal.service.ReportPortal) Test(org.junit.jupiter.api.Test)

Example 15 with ReportPortal

use of com.epam.reportportal.service.ReportPortal in project agent-java-testNG by reportportal.

the class CallbackReportingIntegrationTest method initMocks.

@BeforeEach
@SuppressWarnings("unchecked")
public void initMocks() {
    ReportPortalClient reportPortalClient = mock(ReportPortalClient.class);
    when(reportPortalClient.startLaunch(any())).thenReturn(Maybe.just(new StartLaunchRS("launchUuid", 1L)));
    Maybe<ItemCreatedRS> suiteMaybe = Maybe.just(new ItemCreatedRS(suitedUuid, suitedUuid));
    when(reportPortalClient.startTestItem(any())).thenReturn(suiteMaybe);
    Maybe<ItemCreatedRS> testClassMaybe = Maybe.just(new ItemCreatedRS(testClassUuid, testClassUuid));
    when(reportPortalClient.startTestItem(eq(suiteMaybe.blockingGet().getId()), any())).thenReturn(testClassMaybe);
    Maybe<ItemCreatedRS> testMethodMaybe = Maybe.just(new ItemCreatedRS(testMethodUuid, testMethodUuid));
    when(reportPortalClient.startTestItem(eq(testClassMaybe.blockingGet().getId()), any())).thenReturn(testMethodMaybe);
    Maybe<OperationCompletionRS> finishResponse = Maybe.just(new OperationCompletionRS("finished"));
    when(reportPortalClient.finishTestItem(eq(testMethodUuid), any())).thenReturn(finishResponse);
    when(reportPortalClient.log(any(List.class))).thenReturn(Maybe.just(new BatchSaveOperatingRS()));
    when(reportPortalClient.log(any(SaveLogRQ.class))).thenReturn(Maybe.just(new EntryCreatedAsyncRS("logId")));
    ListenerParameters params = standardParameters();
    params.setCallbackReportingEnabled(true);
    final ReportPortal reportPortal = ReportPortal.create(reportPortalClient, params);
    CallbackReportingListener.initReportPortal(reportPortal);
}
Also used : StartLaunchRS(com.epam.ta.reportportal.ws.model.launch.StartLaunchRS) SaveLogRQ(com.epam.ta.reportportal.ws.model.log.SaveLogRQ) ListenerParameters(com.epam.reportportal.listeners.ListenerParameters) ReportPortal(com.epam.reportportal.service.ReportPortal) ItemCreatedRS(com.epam.ta.reportportal.ws.model.item.ItemCreatedRS) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ReportPortal (com.epam.reportportal.service.ReportPortal)24 BeforeEach (org.junit.jupiter.api.BeforeEach)17 ListenerParameters (com.epam.reportportal.listeners.ListenerParameters)7 StartLaunchRQ (com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)4 SaveLogRQ (com.epam.ta.reportportal.ws.model.log.SaveLogRQ)4 Launch (com.epam.reportportal.service.Launch)3 ParameterKey (com.epam.reportportal.annotations.ParameterKey)2 TestCaseId (com.epam.reportportal.annotations.TestCaseId)2 Attributes (com.epam.reportportal.annotations.attribute.Attributes)2 ItemType (com.epam.reportportal.junit5.ItemType)2 SystemAttributesFetcher.collectSystemAttributes (com.epam.reportportal.junit5.SystemAttributesFetcher.collectSystemAttributes)2 ItemTreeUtils.createItemTreeKey (com.epam.reportportal.junit5.utils.ItemTreeUtils.createItemTreeKey)2 ItemStatus (com.epam.reportportal.listeners.ItemStatus)2 TestCaseIdEntry (com.epam.reportportal.service.item.TestCaseIdEntry)2 TestItemTree (com.epam.reportportal.service.tree.TestItemTree)2 TestItemTree.createTestItemLeaf (com.epam.reportportal.service.tree.TestItemTree.createTestItemLeaf)2 AttributeParser (com.epam.reportportal.utils.AttributeParser)2 ParameterUtils (com.epam.reportportal.utils.ParameterUtils)2 TestCaseIdUtils (com.epam.reportportal.utils.TestCaseIdUtils)2 com.epam.ta.reportportal.ws.model (com.epam.ta.reportportal.ws.model)2