diff --git a/example-cucumber/src/main/java/com/epam/reportportal/example/cucumber/reporter/ScenarioReporterTestCaseId.java b/example-cucumber/src/main/java/com/epam/reportportal/example/cucumber/reporter/ScenarioReporterTestCaseId.java index f6e8079e..97be020d 100644 --- a/example-cucumber/src/main/java/com/epam/reportportal/example/cucumber/reporter/ScenarioReporterTestCaseId.java +++ b/example-cucumber/src/main/java/com/epam/reportportal/example/cucumber/reporter/ScenarioReporterTestCaseId.java @@ -22,6 +22,8 @@ import gherkin.formatter.model.Scenario; import gherkin.formatter.model.Step; +import javax.annotation.Nonnull; + import static org.apache.commons.lang3.StringUtils.isNotBlank; /** @@ -33,8 +35,9 @@ public class ScenarioReporterTestCaseId extends ScenarioReporter { public static final String TEST_TRACKING_TICKET_PREFIX = "JIRA"; // Getting our custom tag from already parsed attributes and set it as Test Case ID for the item + @Nonnull @Override - protected StartTestItemRQ buildStartScenarioRequest(Scenario scenario, String uri) { + protected StartTestItemRQ buildStartScenarioRequest(@Nonnull Scenario scenario, @Nonnull String uri) { StartTestItemRQ rq = super.buildStartScenarioRequest(scenario, uri); rq.getAttributes() .stream() @@ -46,8 +49,9 @@ protected StartTestItemRQ buildStartScenarioRequest(Scenario scenario, String ur } // Removing Test Case ID from nested steps as redundant + @Nonnull @Override - protected StartTestItemRQ buildStartStepRequest(Step step, String stepPrefix, Match match) { + protected StartTestItemRQ buildStartStepRequest(@Nonnull Step step, String stepPrefix, @Nonnull Match match) { StartTestItemRQ rq = super.buildStartStepRequest(step, stepPrefix, match); rq.setTestCaseId(null); return rq; diff --git a/example-cucumber/src/test/groovy/RunCucumberGroovy.groovy b/example-cucumber/src/test/groovy/RunStepReporterTest.groovy similarity index 76% rename from example-cucumber/src/test/groovy/RunCucumberGroovy.groovy rename to example-cucumber/src/test/groovy/RunStepReporterTest.groovy index 9e4019b4..631e5637 100644 --- a/example-cucumber/src/test/groovy/RunCucumberGroovy.groovy +++ b/example-cucumber/src/test/groovy/RunStepReporterTest.groovy @@ -19,10 +19,8 @@ import org.junit.runner.RunWith */ @RunWith(Cucumber.class) -@CucumberOptions(plugin = ["pretty", - "com.epam.reportportal.cucumber.StepReporter"], features = ["src/test/resources/features/attribute"] - , glue = ["src/test/groovy/cucumber"] -) -class RunCucumberGroovy { +@CucumberOptions(plugin = ["pretty", "com.epam.reportportal.cucumber.StepReporter"], features = ["src/test/resources/features/attribute"], + glue = ["src/test/groovy/cucumber"]) +class RunStepReporterTest { } diff --git a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunCukesTestScenarioReporter.java b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunScenarioReporterTest.java similarity index 82% rename from example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunCukesTestScenarioReporter.java rename to example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunScenarioReporterTest.java index a6458711..2a29764c 100644 --- a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunCukesTestScenarioReporter.java +++ b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunScenarioReporterTest.java @@ -25,7 +25,7 @@ * A JUnit runner for Cucumber which is using customized {@link ScenarioReporterTestCaseId} reporter. */ @RunWith(Cucumber.class) -@CucumberOptions(plugin = { "pretty", "com.epam.reportportal.example.cucumber.reporter.ScenarioReporterTestCaseId" }, features = { - "src/test/resources/features/attribute" }, glue = { "com.epam.reportportal.example.cucumber.attribute" }) -public class RunCukesTestScenarioReporter { +@CucumberOptions(plugin = { "pretty", "com.epam.reportportal.example.cucumber.reporter.ScenarioReporterTestCaseId" }, + features = "src/test/resources/features/attribute") +public class RunScenarioReporterTest { } diff --git a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunCukesTestStepReporter.java b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunStepReporterTest.java similarity index 57% rename from example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunCukesTestStepReporter.java rename to example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunStepReporterTest.java index d057f1d0..727aee62 100644 --- a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunCukesTestStepReporter.java +++ b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/RunStepReporterTest.java @@ -5,8 +5,6 @@ import org.junit.runner.RunWith; @RunWith(Cucumber.class) -@CucumberOptions(plugin = { "pretty", "com.epam.reportportal.cucumber.StepReporter" }, - features = {"src/test/resources/features/attribute"}, - glue = {"com.epam.reportportal.example.cucumber.attribute"}) -public class RunCukesTestStepReporter { -} \ No newline at end of file +@CucumberOptions(plugin = { "pretty", "com.epam.reportportal.cucumber.StepReporter" }, features = "src/test/resources/features/attribute") +public class RunStepReporterTest { +} diff --git a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/logging/ReportAttachmentsTest.java b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/logging/ReportAttachmentsTest.java index 42f9de3e..52e0520e 100644 --- a/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/logging/ReportAttachmentsTest.java +++ b/example-cucumber/src/test/java/com/epam/reportportal/example/cucumber/logging/ReportAttachmentsTest.java @@ -16,57 +16,57 @@ public class ReportAttachmentsTest { private static final Logger LOGGER = LoggerFactory.getLogger(ReportAttachmentsTest.class); - public static final String XML_FILE_PATH = "files/file.xml"; - public static final String JSON_FILE_PATH = "files/file.json"; + public static final String XML_FILE_PATH = "src/test/resources/files/file.xml"; + public static final String JSON_FILE_PATH = "src/test/resources/files/file.json"; @Given("I attach logCss") public void logCss() { - LoggingUtils.log(new File("files/file.css"), "I'm logging CSS"); + LoggingUtils.log(new File("src/test/resources/files/file.css"), "I'm logging CSS"); } @Given("I attach logHtml") public void logHtml() { - LoggingUtils.log(new File("files/file.html"), "I'm logging HTML"); + LoggingUtils.log(new File("src/test/resources/files/file.html"), "I'm logging HTML"); } @Given("I attach logPdf") public void logPdf() { - LoggingUtils.log(new File("files/file.pdf"), "I'm logging PDF"); + LoggingUtils.log(new File("src/test/resources/files/file.pdf"), "I'm logging PDF"); } @Given("I attach logZip") public void logZip() { - LoggingUtils.log(new File("files/file.zip"), "I'm logging ZIP"); + LoggingUtils.log(new File("src/test/resources/files/file.zip"), "I'm logging ZIP"); } @Given("I attach logHar") public void logHar() { - LoggingUtils.log(new File("files/file.har"), "I'm logging HAR"); + LoggingUtils.log(new File("src/test/resources/files/file.har"), "I'm logging HAR"); } @Given("I attach logJavascript") public void logJavascript() { - LoggingUtils.log(new File("files/file.js"), "I'm logging JS"); + LoggingUtils.log(new File("src/test/resources/files/file.js"), "I'm logging JS"); } @Given("I attach logPhp") public void logPhp() { - LoggingUtils.log(new File("files/file.php"), "I'm logging php"); + LoggingUtils.log(new File("src/test/resources/files/file.php"), "I'm logging PHP"); } @Given("I attach logPlain") public void logPlain() { - LoggingUtils.log(new File("files/file.txt"), "I'm logging txt"); + LoggingUtils.log(new File("src/test/resources/files/file.txt"), "I'm logging TXT"); } @Given("I attach logCsv") public void logCsv() { - LoggingUtils.log(new File("files/file.csv"), "I'm logging txt"); + LoggingUtils.log(new File("src/test/resources/files/file.csv"), "I'm logging CSV"); } @Given("I attach logCmd") public void logCmd() { - LoggingUtils.log(new File("files/file.cmd"), "I'm logging txt"); + LoggingUtils.log(new File("src/test/resources/files/file.cmd"), "I'm logging CMD"); } @Given("I attach logXmlBase64") @@ -88,7 +88,7 @@ public void logXmlFile() { public void logJsonBase64() throws IOException { /* here we are logging some binary data as BASE64 string */ ReportPortal.emitLog("ITEM LOG MESSAGE", "error", new Date()); - ReportPortal.emitLog("ITEM LOG MESSAGE WITH ATTACHMENT", "error", new Date(), new File("files/css.css")); + ReportPortal.emitLog("ITEM LOG MESSAGE WITH ATTACHMENT", "error", new Date(), new File("src/test/resources/files/file.css")); LOGGER.info( "RP_MESSAGE#BASE64#{}#{}", Base64.getEncoder().encodeToString(Utils.getFileAsByteSource(new File(JSON_FILE_PATH)).read()), @@ -121,6 +121,6 @@ public void logImageBase64() throws IOException { } private String getImageResource(boolean lucky) { - return "pug/" + (lucky ? "lucky.jpg" : "unlucky.jpg"); + return "src/test/resources/pug/" + (lucky ? "lucky.jpg" : "unlucky.jpg"); } }