Search in sources :

Example 61 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project allure-java by reportportal.

the class AttributeTests method verify_scenario_attributes_step_reporter.

@Test
public void verify_scenario_attributes_step_reporter() {
    TestNG result = TestUtils.runTests(ScenarioStepReporter.class);
    assertThat(result.getStatus(), equalTo(0));
    ArgumentCaptor<StartTestItemRQ> captor = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(any(StartTestItemRQ.class));
    verify(client).startTestItem(same(featureId), captor.capture());
    verify(client, times(3)).startTestItem(same(scenarioId), any(StartTestItemRQ.class));
    StartTestItemRQ scenarioItem = captor.getValue();
    assertThat(scenarioItem.getAttributes(), allOf(hasSize(3)));
    Set<Pair<String, String>> attributes = scenarioItem.getAttributes().stream().map(a -> Pair.of(a.getKey(), a.getValue())).collect(Collectors.toSet());
    ATTRIBUTES.forEach(a -> assertThat(attributes, hasItem(equalTo(a))));
    String description = scenarioItem.getDescription();
    SUITE_DESCRIPTION_LINKS.forEach(d -> assertThat(description, containsString(d)));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) ListenerParameters(com.epam.reportportal.listeners.ListenerParameters) ReportPortal(com.epam.reportportal.service.ReportPortal) AbstractTestNGCucumberTests(cucumber.api.testng.AbstractTestNGCucumberTests) HashSet(java.util.HashSet) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) ArgumentCaptor(org.mockito.ArgumentCaptor) CucumberOptions(cucumber.api.CucumberOptions) Pair(org.apache.commons.lang3.tuple.Pair) TestNG(org.testng.TestNG) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ExecutorService(java.util.concurrent.ExecutorService) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) TestUtils(com.epam.reportportal.cucumber.util.TestUtils) CommonUtils(com.epam.reportportal.util.test.CommonUtils) Set(java.util.Set) Matchers(org.hamcrest.Matchers) TestScenarioReporter(com.epam.reportportal.cucumber.integration.TestScenarioReporter) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) Mockito(org.mockito.Mockito) List(java.util.List) Stream(java.util.stream.Stream) TestStepReporter(com.epam.reportportal.cucumber.integration.TestStepReporter) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) TestNG(org.testng.TestNG) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Pair(org.apache.commons.lang3.tuple.Pair) Test(org.junit.jupiter.api.Test)

Example 62 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project allure-java by reportportal.

the class DescriptionAnnotationTest method test_description_conflict_processing.

@Test
public void test_description_conflict_processing() {
    runTests(Collections.singletonList(TestNgListener.class), TestTwoDescription.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();
    assertThat(startMethod.getDescription(), equalTo("My test description" + AnnotationUtils.MARKDOWN_DELIMITER + "My description description"));
}
Also used : TestNgListener(com.epam.reportportal.testng.util.TestNgListener) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 63 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ 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));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) TestFlakyClassLevel(com.epam.reportportal.testng.features.flaky.TestFlakyClassLevel) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) TestFlakyMethodLevel(com.epam.reportportal.testng.features.flaky.TestFlakyMethodLevel) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) List(java.util.List) ArgumentCaptor(org.mockito.ArgumentCaptor) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestUtils(com.epam.reportportal.testng.util.TestUtils) Collections(java.util.Collections) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) Mockito.mock(org.mockito.Mockito.mock) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 64 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ 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));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) TestFlakyClassLevel(com.epam.reportportal.testng.features.flaky.TestFlakyClassLevel) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) TestFlakyMethodLevel(com.epam.reportportal.testng.features.flaky.TestFlakyMethodLevel) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) List(java.util.List) ArgumentCaptor(org.mockito.ArgumentCaptor) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestUtils(com.epam.reportportal.testng.util.TestUtils) Collections(java.util.Collections) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) Mockito.mock(org.mockito.Mockito.mock) TestNgListener(com.epam.reportportal.testng.util.TestNgListener) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 65 with StartTestItemRQ

use of com.epam.ta.reportportal.ws.model.StartTestItemRQ in project allure-java by reportportal.

the class InlineDescriptionTest method verify_a_story_with_meta_attributes.

@Test
public void verify_a_story_with_meta_attributes() {
    run(format, STORY_PATH, new DescriptionSteps());
    ArgumentCaptor<StartTestItemRQ> startCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(any(StartTestItemRQ.class));
    verify(client).startTestItem(same(storyId), any(StartTestItemRQ.class));
    verify(client).startTestItem(same(scenarioId), startCaptor.capture());
    ArgumentCaptor<FinishTestItemRQ> finishCaptor = ArgumentCaptor.forClass(FinishTestItemRQ.class);
    verify(client).finishTestItem(same(stepId), finishCaptor.capture());
    verify(client).finishTestItem(same(scenarioId), any(FinishTestItemRQ.class));
    verify(client).finishTestItem(same(stepId), any(FinishTestItemRQ.class));
    assertThat(startCaptor.getValue().getDescription(), emptyOrNullString());
    assertThat(finishCaptor.getValue().getDescription(), equalTo(DescriptionSteps.DESCRIPTION));
}
Also used : StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) DescriptionSteps(com.epam.reportportal.jbehave.integration.DescriptionSteps) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) Test(org.junit.jupiter.api.Test)

Aggregations

StartTestItemRQ (com.epam.ta.reportportal.ws.model.StartTestItemRQ)159 Test (org.junit.jupiter.api.Test)124 FinishTestItemRQ (com.epam.ta.reportportal.ws.model.FinishTestItemRQ)30 List (java.util.List)21 TestNG (org.testng.TestNG)21 Launch (com.epam.reportportal.service.Launch)20 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)19 BeforeEach (org.junit.jupiter.api.BeforeEach)19 TestNgListener (com.epam.reportportal.testng.util.TestNgListener)18 Collectors (java.util.stream.Collectors)17 ArgumentCaptor (org.mockito.ArgumentCaptor)17 ReportPortal (com.epam.reportportal.service.ReportPortal)16 ReportPortalClient (com.epam.reportportal.service.ReportPortalClient)15 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)15 ArgumentMatchers.same (org.mockito.ArgumentMatchers.same)14 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)13 ItemAttributesRQ (com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)13 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)12 Set (java.util.Set)12 Nonnull (javax.annotation.Nonnull)12