From 7615fa52eabb9f5cda55c3dd9ccf8c92ff5fdcc7 Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Thu, 18 Jan 2024 18:22:56 +0300 Subject: [PATCH] Client version update and refactoring --- CHANGELOG.md | 4 + build.gradle | 7 +- .../cucumber/AbstractReporter.java | 84 +++++------ .../cucumber/ScenarioReporter.java | 7 +- .../reportportal/cucumber/StepReporter.java | 7 +- .../com/epam/reportportal/cucumber/Utils.java | 133 +++--------------- .../ParameterScenarioReporterTest.java | 3 +- .../cucumber/ParameterStepReporterTest.java | 24 ++-- 8 files changed, 90 insertions(+), 179 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10a81d2..5b0a3c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog ## [Unreleased] +### Changed +- Client version updated on [5.2.0](https://github.com/reportportal/client-java/releases/tag/5.2.0), by @HardNorth +### Removed +- Deprecated code, by @HardNorth ## [5.2.0] ### Changed diff --git a/build.gradle b/build.gradle index b00aa5e..b28ab3a 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ repositories { } dependencies { - api 'com.epam.reportportal:client-java:5.1.22' + api 'com.epam.reportportal:client-java:5.2.1' api 'com.epam.reportportal:commons-model:5.0.0' api 'com.google.code.findbugs:jsr305:3.0.2' @@ -53,8 +53,8 @@ dependencies { testImplementation 'org.hamcrest:hamcrest-core:2.2' testImplementation 'org.mockito:mockito-core:3.3.3' testImplementation 'org.mockito:mockito-junit-jupiter:3.3.3' - testImplementation 'ch.qos.logback:logback-classic:1.4.8' - testImplementation 'com.epam.reportportal:logger-java-logback:5.1.5' + testImplementation 'ch.qos.logback:logback-classic:1.4.12' + testImplementation 'com.epam.reportportal:logger-java-logback:5.2.0' testImplementation ("org.junit.platform:junit-platform-runner:${project.junit_runner_version}") { exclude module: 'junit' } @@ -62,6 +62,7 @@ dependencies { testImplementation "org.junit.jupiter:junit-jupiter-params:${project.junit_version}" testImplementation "org.junit.jupiter:junit-jupiter-engine:${project.junit_version}" testImplementation 'org.apache.commons:commons-io:1.3.2' + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' } test { diff --git a/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java b/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java index 251400b..69a803d 100644 --- a/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java +++ b/src/main/java/com/epam/reportportal/cucumber/AbstractReporter.java @@ -18,6 +18,7 @@ import com.epam.reportportal.annotations.TestCaseId; import com.epam.reportportal.annotations.attribute.Attributes; import com.epam.reportportal.listeners.ItemStatus; +import com.epam.reportportal.listeners.ItemType; import com.epam.reportportal.listeners.ListenerParameters; import com.epam.reportportal.message.ReportPortalMessage; import com.epam.reportportal.service.Launch; @@ -25,19 +26,20 @@ import com.epam.reportportal.service.item.TestCaseIdEntry; import com.epam.reportportal.service.tree.TestItemTree; import com.epam.reportportal.utils.*; +import com.epam.reportportal.utils.files.ByteSource; +import com.epam.reportportal.utils.markdown.MarkdownUtils; import com.epam.reportportal.utils.properties.SystemAttributesExtractor; +import com.epam.reportportal.utils.reflect.Accessible; import com.epam.ta.reportportal.ws.model.FinishExecutionRQ; import com.epam.ta.reportportal.ws.model.FinishTestItemRQ; import com.epam.ta.reportportal.ws.model.ParameterResource; import com.epam.ta.reportportal.ws.model.StartTestItemRQ; import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ; import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ; -import com.google.common.io.ByteSource; import io.cucumber.core.gherkin.Feature; import io.cucumber.plugin.ConcurrentEventListener; import io.cucumber.plugin.event.*; import io.reactivex.Maybe; -import okhttp3.MediaType; import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,8 +48,6 @@ import javax.annotation.Nullable; import java.io.File; import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URI; import java.util.*; @@ -58,7 +58,6 @@ import static com.epam.reportportal.cucumber.Utils.*; import static com.epam.reportportal.cucumber.util.ItemTreeUtils.createKey; import static com.epam.reportportal.cucumber.util.ItemTreeUtils.retrieveLeaf; -import static java.util.Optional.of; import static java.util.Optional.ofNullable; import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace; @@ -74,6 +73,7 @@ public abstract class AbstractReporter implements ConcurrentEventListener { private static final String NO_NAME = "No name"; private static final String AGENT_PROPERTIES_FILE = "agent.properties"; + private static final String DEFINITION_MATCH_FIELD_NAME = "definitionMatch"; private static final String STEP_DEFINITION_FIELD_NAME = "stepDefinition"; private static final String GET_LOCATION_METHOD_NAME = "getLocation"; private static final String COLON_INFIX = ": "; @@ -448,27 +448,18 @@ protected void afterStep(@Nonnull TestCase testCase, @Nonnull TestStep testStep, */ @Nonnull protected Pair getHookTypeAndName(@Nonnull HookType hookType) { - String name = null; - String type = null; switch (hookType) { case BEFORE: - name = "Before hooks"; - type = "BEFORE_TEST"; - break; + return Pair.of(ItemType.BEFORE_TEST.name(), "Before hooks"); case AFTER: - name = "After hooks"; - type = "AFTER_TEST"; - break; + return Pair.of(ItemType.AFTER_TEST.name(), "After hooks"); case AFTER_STEP: - name = "After step"; - type = "AFTER_METHOD"; - break; + return Pair.of(ItemType.AFTER_METHOD.name(), "After step"); case BEFORE_STEP: - name = "Before step"; - type = "BEFORE_METHOD"; - break; + return Pair.of(ItemType.BEFORE_METHOD.name(), "Before step"); + default: + return Pair.of(ItemType.TEST.name(), "Hook"); } - return Pair.of(type, name); } /** @@ -589,15 +580,7 @@ private static String getDataType(@Nonnull byte[] data, @Nullable String name) { * @param data data to attach */ protected void embedding(@Nullable String name, @Nullable String mimeType, @Nonnull byte[] data) { - String type = ofNullable(mimeType).filter(m -> { - try { - MediaType.get(m); - return true; - } catch (IllegalArgumentException e) { - LOGGER.warn("Incorrect media type '{}'", m); - return false; - } - }).orElseGet(() -> getDataType(data, name)); + String type = ofNullable(mimeType).orElseGet(() -> getDataType(data, name)); String attachmentName = ofNullable(name).filter(m -> !m.isEmpty()) .orElseGet(() -> ofNullable(type).map(t -> t.substring(0, t.indexOf("/"))).orElse("")); ReportPortal.emitLog(new ReportPortalMessage(ByteSource.wrap(data), type, attachmentName), @@ -976,7 +959,7 @@ protected String mapLevel(@Nullable Status cukesStatus) { */ @Nonnull protected String formatDataTable(@Nonnull final List> table) { - return Utils.formatDataTable(table); + return MarkdownUtils.formatDataTable(table); } /** @@ -1019,26 +1002,31 @@ protected String buildMultilineArgument(@Nonnull TestStep step) { */ @Nullable protected String getCodeRef(@Nonnull TestStep testStep) { - return ofNullable(getDefinitionMatchField(testStep)).flatMap(match -> { - try { - Object stepDefinitionMatch = match.get(testStep); - Field stepDefinitionField = stepDefinitionMatch.getClass().getDeclaredField(STEP_DEFINITION_FIELD_NAME); - stepDefinitionField.setAccessible(true); - Object javaStepDefinition = stepDefinitionField.get(stepDefinitionMatch); - Method getLocationMethod = javaStepDefinition.getClass().getMethod(GET_LOCATION_METHOD_NAME); - getLocationMethod.setAccessible(true); - return of(String.valueOf(getLocationMethod.invoke(javaStepDefinition))).filter(r -> !r.isEmpty()).map(r -> { - int openingBracketIndex = r.indexOf(METHOD_OPENING_BRACKET); - if (openingBracketIndex > 0) { - return r.substring(0, r.indexOf(METHOD_OPENING_BRACKET)); - } else { - return r; + String cucumberLocation = testStep.getCodeLocation(); + try { + Object stepDefinitionMatch = Accessible.on(testStep).field(DEFINITION_MATCH_FIELD_NAME).getValue(); + if (stepDefinitionMatch != null) { + Object javaStepDefinition = Accessible.on(stepDefinitionMatch).field(STEP_DEFINITION_FIELD_NAME).getValue(); + if (javaStepDefinition != null) { + Object codeLocationObject = Accessible.on(javaStepDefinition).method(GET_LOCATION_METHOD_NAME).invoke(); + if (codeLocationObject != null) { + String codeLocation = codeLocationObject.toString(); + if (isNotBlank(codeLocation)) { + int openingBracketIndex = codeLocation.indexOf(METHOD_OPENING_BRACKET); + if (openingBracketIndex > 0) { + return codeLocation.substring(0, codeLocation.indexOf(METHOD_OPENING_BRACKET)); + } else { + return codeLocation; + } + } } - }); - } catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignore) { + } } - return Optional.empty(); - }).orElseGet(testStep::getCodeLocation); + } catch (Throwable e) { + LOGGER.error("Unable to get java code reference for the Test Step: " + cucumberLocation, e); + return cucumberLocation; + } + return cucumberLocation; } /** diff --git a/src/main/java/com/epam/reportportal/cucumber/ScenarioReporter.java b/src/main/java/com/epam/reportportal/cucumber/ScenarioReporter.java index 25adf2d..0a7bb88 100644 --- a/src/main/java/com/epam/reportportal/cucumber/ScenarioReporter.java +++ b/src/main/java/com/epam/reportportal/cucumber/ScenarioReporter.java @@ -15,6 +15,7 @@ */ package com.epam.reportportal.cucumber; +import com.epam.reportportal.listeners.ItemType; import com.epam.reportportal.utils.MemoizingSupplier; import com.epam.ta.reportportal.ws.model.StartTestItemRQ; import io.cucumber.plugin.event.HookTestStep; @@ -47,9 +48,9 @@ * @author Vadzim Hushchanskou */ public class ScenarioReporter extends AbstractReporter { - private static final String RP_STORY_TYPE = "SUITE"; - private static final String RP_TEST_TYPE = "STORY"; - private static final String RP_STEP_TYPE = "STEP"; + private static final String RP_STORY_TYPE = ItemType.SUITE.name(); + private static final String RP_TEST_TYPE = ItemType.STORY.name(); + private static final String RP_STEP_TYPE = ItemType.STEP.name(); private static final String DUMMY_ROOT_SUITE_NAME = "Root User Story"; protected MemoizingSupplier> rootSuiteId; diff --git a/src/main/java/com/epam/reportportal/cucumber/StepReporter.java b/src/main/java/com/epam/reportportal/cucumber/StepReporter.java index b5294e7..8c55382 100644 --- a/src/main/java/com/epam/reportportal/cucumber/StepReporter.java +++ b/src/main/java/com/epam/reportportal/cucumber/StepReporter.java @@ -15,6 +15,7 @@ */ package com.epam.reportportal.cucumber; +import com.epam.reportportal.listeners.ItemType; import io.reactivex.Maybe; import javax.annotation.Nonnull; @@ -37,10 +38,12 @@ * steps!) * * @author Vadzim Hushchanskou + * @deprecated Use {@link ScenarioReporter}, since the semantic of this class is completely broken and will be removed */ +@Deprecated(forRemoval = true, since = "5.3.0") public class StepReporter extends AbstractReporter { - private static final String RP_STORY_TYPE = "STORY"; - private static final String RP_TEST_TYPE = "SCENARIO"; + private static final String RP_STORY_TYPE = ItemType.STORY.name(); + private static final String RP_TEST_TYPE = ItemType.SCENARIO.name(); public StepReporter() { super(); diff --git a/src/main/java/com/epam/reportportal/cucumber/Utils.java b/src/main/java/com/epam/reportportal/cucumber/Utils.java index d3ba796..5b29992 100644 --- a/src/main/java/com/epam/reportportal/cucumber/Utils.java +++ b/src/main/java/com/epam/reportportal/cucumber/Utils.java @@ -19,16 +19,11 @@ import io.cucumber.core.gherkin.Feature; import io.cucumber.plugin.event.Argument; import io.cucumber.plugin.event.Status; -import io.cucumber.plugin.event.TestStep; -import com.google.common.collect.ImmutableMap; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.IntStream; import static java.util.Optional.ofNullable; @@ -39,15 +34,6 @@ */ public class Utils { private static final String EMPTY = ""; - - private static final String DEFINITION_MATCH_FIELD_NAME = "definitionMatch"; - private static final String STEP_DEFINITION_FIELD_NAME = "stepDefinition"; - private static final String METHOD_FIELD_NAME = "method"; - public static final String ONE_SPACE = "\u00A0"; - public static final String NEW_LINE = "\r\n"; - public static final String TABLE_INDENT = "\u00A0\u00A0\u00A0\u00A0"; - public static final String TABLE_COLUMN_SEPARATOR = "|"; - public static final String TABLE_ROW_SEPARATOR = "-"; public static final String TAG_KEY = "@"; private Utils() { @@ -55,24 +41,26 @@ private Utils() { } //@formatter:off - public static final Map STATUS_MAPPING = ImmutableMap.builder() - .put(Status.PASSED, ItemStatus.PASSED) - .put(Status.FAILED, ItemStatus.FAILED) - .put(Status.SKIPPED, ItemStatus.SKIPPED) - .put(Status.PENDING, ItemStatus.SKIPPED) - .put(Status.AMBIGUOUS, ItemStatus.SKIPPED) - .put(Status.UNDEFINED, ItemStatus.SKIPPED) - .put(Status.UNUSED, ItemStatus.SKIPPED).build(); - - public static final Map LOG_LEVEL_MAPPING = ImmutableMap.builder() - .put(Status.PASSED, "INFO") - .put(Status.FAILED, "ERROR") - .put(Status.SKIPPED, "WARN") - .put(Status.PENDING, "WARN") - .put(Status.AMBIGUOUS, "WARN") - .put(Status.UNDEFINED, "WARN") - .put(Status.UNUSED, "WARN").build(); - //@formatter:on + public static final Map STATUS_MAPPING = Map.of( + Status.PASSED, ItemStatus.PASSED, + Status.FAILED, ItemStatus.FAILED, + Status.SKIPPED, ItemStatus.SKIPPED, + Status.PENDING, ItemStatus.SKIPPED, + Status.AMBIGUOUS, ItemStatus.SKIPPED, + Status.UNDEFINED, ItemStatus.SKIPPED, + Status.UNUSED, ItemStatus.SKIPPED + ); + + public static final Map LOG_LEVEL_MAPPING = Map.of( + Status.PASSED, "INFO", + Status.FAILED, "ERROR", + Status.SKIPPED, "WARN", + Status.PENDING, "WARN", + Status.AMBIGUOUS, "WARN", + Status.UNDEFINED, "WARN", + Status.UNUSED, "WARN" + ); + //@formatter:on /** * Generate name representation @@ -86,84 +74,9 @@ public static String buildName(@Nullable String prefix, @Nullable String infix, return (prefix == null ? EMPTY : prefix) + infix + argument; } - @Deprecated - public static Method retrieveMethod(Field definitionMatchField, TestStep testStep) throws IllegalAccessException, NoSuchFieldException { - Object stepDefinitionMatch = definitionMatchField.get(testStep); - Field stepDefinitionField = stepDefinitionMatch.getClass().getDeclaredField(STEP_DEFINITION_FIELD_NAME); - stepDefinitionField.setAccessible(true); - Object javaStepDefinition = stepDefinitionField.get(stepDefinitionMatch); - Field methodField = javaStepDefinition.getClass().getSuperclass().getDeclaredField(METHOD_FIELD_NAME); - methodField.setAccessible(true); - return (Method) methodField.get(javaStepDefinition); - } - public static final java.util.function.Function, List> ARGUMENTS_TRANSFORM = arguments -> ofNullable(arguments).map( args -> args.stream().map(Argument::getValue).collect(Collectors.toList())).orElse(null); - public static Field getDefinitionMatchField(TestStep testStep) { - Class clazz = testStep.getClass(); - try { - return clazz.getField(DEFINITION_MATCH_FIELD_NAME); - } catch (NoSuchFieldException e) { - do { - try { - Field definitionMatchField = clazz.getDeclaredField(DEFINITION_MATCH_FIELD_NAME); - definitionMatchField.setAccessible(true); - return definitionMatchField; - } catch (NoSuchFieldException ignore) { - } - - clazz = clazz.getSuperclass(); - } while (clazz != null); - - return null; - } - } - - /** - * Converts a table represented as List of Lists to a formatted table string - * - * @param table a table object - * @return string representation of the table - */ - @Nonnull - public static String formatDataTable(@Nonnull final List> table) { - StringBuilder result = new StringBuilder(); - int tableLength = table.stream().mapToInt(List::size).max().orElse(-1); - List> iterList = table.stream().map(List::iterator).collect(Collectors.toList()); - List colSizes = IntStream.range(0, tableLength) - .mapToObj(n -> iterList.stream().filter(Iterator::hasNext).map(Iterator::next).collect(Collectors.toList())) - .map(col -> col.stream().mapToInt(String::length).max().orElse(0)) - .collect(Collectors.toList()); - - boolean header = true; - for (List row : table) { - result.append(TABLE_INDENT).append(TABLE_COLUMN_SEPARATOR); - for (int i = 0; i < row.size(); i++) { - String cell = row.get(i); - int maxSize = colSizes.get(i) - cell.length() + 2; - int lSpace = maxSize / 2; - int rSpace = maxSize - lSpace; - IntStream.range(0, lSpace).forEach(j -> result.append(ONE_SPACE)); - result.append(cell); - IntStream.range(0, rSpace).forEach(j -> result.append(ONE_SPACE)); - result.append(TABLE_COLUMN_SEPARATOR); - } - if(header) { - header = false; - result.append(NEW_LINE); - result.append(TABLE_INDENT).append(TABLE_COLUMN_SEPARATOR); - for (int i = 0; i < row.size(); i++) { - int maxSize = colSizes.get(i) + 2; - IntStream.range(0, maxSize).forEach(j -> result.append(TABLE_ROW_SEPARATOR)); - result.append(TABLE_COLUMN_SEPARATOR); - } - } - result.append(NEW_LINE); - } - return result.toString().trim(); - } - /** * Parses a feature source and return all declared tags before the feature. * @@ -172,11 +85,11 @@ public static String formatDataTable(@Nonnull final List> table) { */ @Nonnull public static Set getTags(@Nonnull Feature feature) { - return feature.getKeyword().map(k->{ + return feature.getKeyword().map(k -> { Set tags = new HashSet<>(); - for(String line : feature.getSource().split("\\r?\\n")) { + for (String line : feature.getSource().split("\\r?\\n")) { String bareLine = line.trim(); - if(bareLine.startsWith(k)) { + if (bareLine.startsWith(k)) { return tags; } if (!line.startsWith(TAG_KEY)) { diff --git a/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java b/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java index 7dfe473..941b310 100644 --- a/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java +++ b/src/test/java/com/epam/reportportal/cucumber/ParameterScenarioReporterTest.java @@ -23,6 +23,7 @@ import com.epam.reportportal.service.ReportPortal; import com.epam.reportportal.service.ReportPortalClient; import com.epam.reportportal.util.test.CommonUtils; +import com.epam.reportportal.utils.markdown.MarkdownUtils; import com.epam.ta.reportportal.ws.model.ParameterResource; import com.epam.ta.reportportal.ws.model.StartTestItemRQ; import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; @@ -73,7 +74,7 @@ public static class DataTableParameterTest extends AbstractTestNGCucumberTests { } private static final String DOCSTRING_PARAM = "My very long parameter\nWith some new lines"; - private static final String TABLE_PARAM = Utils.formatDataTable(Arrays.asList(Arrays.asList("key", "value"), + private static final String TABLE_PARAM = MarkdownUtils.formatDataTable(Arrays.asList(Arrays.asList("key", "value"), Arrays.asList("myKey", "myValue") )); diff --git a/src/test/java/com/epam/reportportal/cucumber/ParameterStepReporterTest.java b/src/test/java/com/epam/reportportal/cucumber/ParameterStepReporterTest.java index 7ab9d09..613f534 100644 --- a/src/test/java/com/epam/reportportal/cucumber/ParameterStepReporterTest.java +++ b/src/test/java/com/epam/reportportal/cucumber/ParameterStepReporterTest.java @@ -23,6 +23,7 @@ import com.epam.reportportal.service.ReportPortal; import com.epam.reportportal.service.ReportPortalClient; import com.epam.reportportal.util.test.CommonUtils; +import com.epam.reportportal.utils.markdown.MarkdownUtils; import com.epam.ta.reportportal.ws.model.ParameterResource; import com.epam.ta.reportportal.ws.model.StartTestItemRQ; import com.epam.ta.reportportal.ws.model.log.SaveLogRQ; @@ -56,39 +57,38 @@ public class ParameterStepReporterTest { @CucumberOptions(features = "src/test/resources/features/BasicScenarioOutlineParameters.feature", glue = { "com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty", "com.epam.reportportal.cucumber.integration.TestStepReporter" }) - public static class RunOutlineParametersTestStepReporter extends AbstractTestNGCucumberTests { + public static class RunOutlineParametersTestStepReporterTest extends AbstractTestNGCucumberTests { } @CucumberOptions(features = "src/test/resources/features/TwoScenarioOutlineParameters.feature", glue = { "com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty", "com.epam.reportportal.cucumber.integration.TestStepReporter" }) - public static class RunTwoOutlineParametersTestStepReporter extends AbstractTestNGCucumberTests { + public static class RunTwoOutlineParametersTestStepReporterTest extends AbstractTestNGCucumberTests { } @CucumberOptions(features = "src/test/resources/features/BasicInlineParameters.feature", glue = { "com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty", "com.epam.reportportal.cucumber.integration.TestStepReporter" }) - public static class InlineParametersTestStepReporter extends AbstractTestNGCucumberTests { + public static class InlineParametersTestStepReporterTest extends AbstractTestNGCucumberTests { } @CucumberOptions(features = "src/test/resources/features/DocStringParameters.feature", glue = { "com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty", "com.epam.reportportal.cucumber.integration.TestStepReporter" }) - public static class DocstringParameterTestStepReporter extends AbstractTestNGCucumberTests { + public static class DocstringParameterTestStepReporterTest extends AbstractTestNGCucumberTests { } @CucumberOptions(features = "src/test/resources/features/DataTableParameter.feature", glue = { "com.epam.reportportal.cucumber.integration.feature" }, plugin = { "pretty", "com.epam.reportportal.cucumber.integration.TestStepReporter" }) - public static class DataTableParameterTestStepReporter extends AbstractTestNGCucumberTests { + public static class DataTableParameterTestStepReporterTest extends AbstractTestNGCucumberTests { } private static final String DOCSTRING_PARAM = "My very long parameter\nWith some new lines"; - private static final String TABLE_PARAM = Utils.formatDataTable(Arrays.asList( - Arrays.asList("key", "value"), + private static final String TABLE_PARAM = MarkdownUtils.formatDataTable(Arrays.asList(Arrays.asList("key", "value"), Arrays.asList("myKey", "myValue") )); @@ -129,7 +129,7 @@ public void initLaunch() { @Test public void verify_agent_retrieves_parameters_from_request() { - TestUtils.runTests(RunOutlineParametersTestStepReporter.class); + TestUtils.runTests(RunOutlineParametersTestStepReporterTest.class); verify(client, times(1)).startTestItem(any()); verify(client, times(3)).startTestItem(same(suiteId), any()); @@ -163,7 +163,7 @@ public void verify_agent_retrieves_parameters_from_request() { @Test public void verify_agent_retrieves_two_parameters_from_request() { - TestUtils.runTests(RunTwoOutlineParametersTestStepReporter.class); + TestUtils.runTests(RunTwoOutlineParametersTestStepReporterTest.class); verify(client, times(1)).startTestItem(any()); verify(client, times(3)).startTestItem(same(suiteId), any()); @@ -185,7 +185,7 @@ public void verify_agent_retrieves_two_parameters_from_request() { @Test public void verify_inline_parameters() { - TestUtils.runTests(InlineParametersTestStepReporter.class); + TestUtils.runTests(InlineParametersTestStepReporterTest.class); ArgumentCaptor captor = ArgumentCaptor.forClass(StartTestItemRQ.class); verify(client, times(3)).startTestItem(same(testIds.get(0)), captor.capture()); @@ -210,7 +210,7 @@ public void verify_inline_parameters() { @Test @SuppressWarnings("unchecked") public void verify_docstring_parameters() { - TestUtils.runTests(DocstringParameterTestStepReporter.class); + TestUtils.runTests(DocstringParameterTestStepReporterTest.class); ArgumentCaptor captor = ArgumentCaptor.forClass(StartTestItemRQ.class); verify(client, times(2)).startTestItem(same(testIds.get(0)), captor.capture()); @@ -235,7 +235,7 @@ public void verify_docstring_parameters() { @Test @SuppressWarnings("unchecked") public void verify_data_table_parameters() { - TestUtils.runTests(DataTableParameterTestStepReporter.class); + TestUtils.runTests(DataTableParameterTestStepReporterTest.class); ArgumentCaptor captor = ArgumentCaptor.forClass(StartTestItemRQ.class); verify(client, times(1)).startTestItem(same(testIds.get(0)), captor.capture());