Search in sources :

Example 1 with ParameterResource

use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.

the class TestItemBuilderTest method testCaseIdGeneratedFromCodeRefAndParamsTest.

@Test
void testCaseIdGeneratedFromCodeRefAndParamsTest() {
    StartTestItemRQ request = new StartTestItemRQ();
    request.setName("item");
    request.setType("step");
    String codeRef = "com.epam.ta.reportportal.core.item.identity.TestCaseIdHandlerImplTest";
    request.setCodeRef(codeRef);
    ParameterResource param1 = new ParameterResource();
    param1.setKey("key1");
    String value1 = "value1";
    param1.setValue(value1);
    ParameterResource param2 = new ParameterResource();
    param2.setKey("key2");
    String value2 = "value2";
    param2.setValue(value2);
    ParameterResource param3 = new ParameterResource();
    param1.setKey("key3");
    request.setParameters(Lists.newArrayList(param1, param2, param3));
    TestItem item = new TestItemBuilder().addStartItemRequest(request).get();
    String expected = codeRef + "[" + value1 + "," + value2 + ",null]";
    assertEquals(expected, item.getTestCaseId());
    assertEquals(expected.hashCode(), item.getTestCaseHash());
}
Also used : ParameterResource(com.epam.ta.reportportal.ws.model.ParameterResource) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 2 with ParameterResource

use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.

the class TestItemBuilderTest method addStartRqTest.

@Test
void addStartRqTest() {
    final StartTestItemRQ rq = new StartTestItemRQ();
    rq.setType("step");
    final ParameterResource parameterResource = new ParameterResource();
    parameterResource.setKey("key");
    parameterResource.setValue("value");
    rq.setParameters(Collections.singletonList(parameterResource));
    final String uuid = "uuid";
    rq.setUniqueId(uuid);
    final String description = "description";
    rq.setDescription(description);
    final LocalDateTime now = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
    rq.setStartTime(TO_DATE.apply(now));
    final String name = "name";
    rq.setName(name);
    final TestItem testItem = new TestItemBuilder().addStartItemRequest(rq).get();
    assertEquals(TestItemTypeEnum.STEP, testItem.getType());
    final Parameter param = new Parameter();
    param.setKey("key");
    param.setValue("value");
    assertTrue(testItem.getParameters().contains(param));
    assertEquals(uuid, testItem.getUniqueId());
    assertEquals(description, testItem.getDescription());
    assertEquals(now, testItem.getStartTime());
    assertEquals(name, testItem.getName());
}
Also used : LocalDateTime(java.time.LocalDateTime) ParameterResource(com.epam.ta.reportportal.ws.model.ParameterResource) Parameter(com.epam.ta.reportportal.entity.item.Parameter) StartTestItemRQ(com.epam.ta.reportportal.ws.model.StartTestItemRQ) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 3 with ParameterResource

use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.

the class ParametersConverterTest method getResource.

private static ParameterResource getResource() {
    ParameterResource resource = new ParameterResource();
    resource.setKey("key");
    resource.setValue("value");
    return resource;
}
Also used : ParameterResource(com.epam.ta.reportportal.ws.model.ParameterResource)

Example 4 with ParameterResource

use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.

the class TestItemControllerTest method getParameters.

private List<ParameterResource> getParameters() {
    ParameterResource parameters = new ParameterResource();
    parameters.setKey("CardNumber");
    parameters.setValue("4444333322221111");
    ParameterResource parameters1 = new ParameterResource();
    parameters1.setKey("Stars");
    parameters1.setValue("2 stars");
    return ImmutableList.<ParameterResource>builder().add(parameters).add(parameters1).build();
}
Also used : ParameterResource(com.epam.ta.reportportal.ws.model.ParameterResource)

Example 5 with ParameterResource

use of com.epam.ta.reportportal.ws.model.ParameterResource in project service-api by reportportal.

the class TestItemBuilderTest method testItemBuilder.

@Test
void testItemBuilder() {
    final Launch launch = new Launch();
    launch.setId(1L);
    launch.setName("name");
    final ParameterResource parameterResource = new ParameterResource();
    parameterResource.setKey("key");
    parameterResource.setValue("value");
    final String description = "description";
    final String typeValue = "step";
    final TestItem testItem = new TestItemBuilder().addDescription(description).addType(typeValue).addLaunchId(launch.getId()).addParameters(Collections.singletonList(parameterResource)).addAttributes(Sets.newHashSet(new ItemAttributesRQ("key", "value"))).addParentId(1L).get();
    assertThat(testItem.getLaunchId()).isEqualToComparingFieldByField(launch.getId());
    assertEquals(description, testItem.getDescription());
    assertEquals(TestItemTypeEnum.STEP, testItem.getType());
    final Parameter param = new Parameter();
    param.setKey("key");
    param.setValue("value");
    assertTrue(testItem.getParameters().contains(param));
    assertThat(testItem.getAttributes()).containsExactly(new ItemAttribute("key", "value", false));
    assertNotNull(testItem.getParentId());
}
Also used : ParameterResource(com.epam.ta.reportportal.ws.model.ParameterResource) Parameter(com.epam.ta.reportportal.entity.item.Parameter) ItemAttributesRQ(com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ) ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) Launch(com.epam.ta.reportportal.entity.launch.Launch) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Aggregations

ParameterResource (com.epam.ta.reportportal.ws.model.ParameterResource)8 Test (org.junit.jupiter.api.Test)6 Parameter (com.epam.ta.reportportal.entity.item.Parameter)4 TestItem (com.epam.ta.reportportal.entity.item.TestItem)3 StartTestItemRQ (com.epam.ta.reportportal.ws.model.StartTestItemRQ)3 ListenerParameters (com.epam.reportportal.listeners.ListenerParameters)1 Launch (com.epam.reportportal.service.Launch)1 ReportPortal (com.epam.reportportal.service.ReportPortal)1 ReportPortalClient (com.epam.reportportal.service.ReportPortalClient)1 com.epam.reportportal.testng.integration.feature.parameters (com.epam.reportportal.testng.integration.feature.parameters)1 TestUtils (com.epam.reportportal.testng.integration.util.TestUtils)1 TestUtils.namedUuid (com.epam.reportportal.testng.integration.util.TestUtils.namedUuid)1 TestUtils.standardParameters (com.epam.reportportal.testng.integration.util.TestUtils.standardParameters)1 MemoizingSupplier (com.epam.reportportal.utils.MemoizingSupplier)1 PropertiesLoader (com.epam.reportportal.utils.properties.PropertiesLoader)1 ItemAttribute (com.epam.ta.reportportal.entity.ItemAttribute)1 Launch (com.epam.ta.reportportal.entity.launch.Launch)1 ItemAttributesRQ (com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ)1 StartLaunchRQ (com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ)1 LocalDateTime (java.time.LocalDateTime)1