Search in sources :

Example 31 with ItemAttributesRQ

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

the class StoryMetaTest method verify_a_story_with_meta_attributes.

@Test
public void verify_a_story_with_meta_attributes() {
    run(format, STORY_PATH, new EmptySteps());
    ArgumentCaptor<StartTestItemRQ> startCaptor = ArgumentCaptor.forClass(StartTestItemRQ.class);
    verify(client).startTestItem(startCaptor.capture());
    verify(client).startTestItem(same(storyId), startCaptor.capture());
    verify(client).startTestItem(same(scenarioId), any());
    List<StartTestItemRQ> items = startCaptor.getAllValues();
    StartTestItemRQ startSuite = items.get(0);
    assertThat(startSuite.getAttributes(), allOf(notNullValue(), hasSize(SUITE_ATTRIBUTES.size())));
    Set<ItemAttributesRQ> suiteAttributes = startSuite.getAttributes();
    suiteAttributes.forEach(a -> assertThat(SUITE_ATTRIBUTES, hasItem(Pair.of(a.getKey(), a.getValue()))));
    StartTestItemRQ startScenario = items.get(1);
    assertThat(startScenario.getAttributes(), empty());
    String description = startSuite.getDescription();
    SUITE_DESCRIPTION_LINKS.forEach(d -> assertThat(description, containsString(d)));
}
Also used : ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) EmptySteps(com.epam.reportportal.jbehave.integration.EmptySteps) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) Test(org.junit.jupiter.api.Test)

Example 32 with ItemAttributesRQ

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

the class SeverityAnnotationTest method test_severity_annotation_method_level_processing.

@Test
public void test_severity_annotation_method_level_processing() {
    runTests(Collections.singletonList(TestNgListener.class), TestPriorityMethodLevel.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> priorityAttributes = attributes.stream().filter(a -> "priority".equals(a.getKey())).collect(Collectors.toList());
    assertThat(priorityAttributes, hasSize(1));
    ItemAttributesRQ priority = priorityAttributes.get(0);
    assertThat(priority.getValue(), equalTo("blocker"));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) TestPriorityClassLevel(com.epam.reportportal.testng.features.priority.TestPriorityClassLevel) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) TestPriorityMethodLevel(com.epam.reportportal.testng.features.priority.TestPriorityMethodLevel) 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.equalTo(org.hamcrest.Matchers.equalTo) 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 33 with ItemAttributesRQ

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

the class SeverityAnnotationTest method test_severity_annotation_class_level_processing.

@Test
public void test_severity_annotation_class_level_processing() {
    runTests(Collections.singletonList(TestNgListener.class), TestPriorityClassLevel.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> priorityAttributes = attributes.stream().filter(a -> "priority".equals(a.getKey())).collect(Collectors.toList());
    assertThat(priorityAttributes, hasSize(1));
    ItemAttributesRQ priority = priorityAttributes.get(0);
    assertThat(priority.getValue(), equalTo("critical"));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) ReportPortalClient(com.epam.reportportal.service.ReportPortalClient) TestPriorityClassLevel(com.epam.reportportal.testng.features.priority.TestPriorityClassLevel) Set(java.util.Set) ReportPortal(com.epam.reportportal.service.ReportPortal) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) TestPriorityMethodLevel(com.epam.reportportal.testng.features.priority.TestPriorityMethodLevel) 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.equalTo(org.hamcrest.Matchers.equalTo) 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)

Aggregations

ItemAttributesRQ (com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)33 Test (org.junit.jupiter.api.Test)19 StartTestItemRQ (com.epam.ta.reportportal.ws.model.StartTestItemRQ)13 StartLaunchRQ (com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)11 Collectors (java.util.stream.Collectors)10 ReportPortal (com.epam.reportportal.service.ReportPortal)9 List (java.util.List)8 Set (java.util.Set)8 ReportPortalClient (com.epam.reportportal.service.ReportPortalClient)7 TestNgListener (com.epam.reportportal.testng.util.TestNgListener)7 TestUtils (com.epam.reportportal.testng.util.TestUtils)7 Collections (java.util.Collections)7 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)7 Matchers.hasSize (org.hamcrest.Matchers.hasSize)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 ArgumentCaptor (org.mockito.ArgumentCaptor)7 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)7 ArgumentMatchers.same (org.mockito.ArgumentMatchers.same)7 Mockito.mock (org.mockito.Mockito.mock)7 Mockito.verify (org.mockito.Mockito.verify)7