diff --git a/example-cucumber2/pom.xml b/example-cucumber2/pom.xml deleted file mode 100644 index 05c0ddb0..00000000 --- a/example-cucumber2/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - - com.epam.reportportal - examples-java - 1.0-SNAPSHOT - - - com.epam.reportportal.example - example-cucumber2 - 1.0-SNAPSHOT - - - UTF-8 - 1.8 - 1.8 - 2.4.0 - - - - - com.epam.reportportal - agent-java-cucumber2 - 5.2.3 - - - - com.epam.reportportal - logger-java-logback - 5.2.2 - - - - io.cucumber - cucumber-java - ${cucumber.version} - - - - io.cucumber - cucumber-junit - ${cucumber.version} - - - junit - junit - - - - - - junit - junit - 4.13.2 - - - - ch.qos.logback - logback-classic - 1.3.12 - - - diff --git a/example-cucumber2/src/main/java/com/epam/reportportal/example/cucumber2/Belly.java b/example-cucumber2/src/main/java/com/epam/reportportal/example/cucumber2/Belly.java deleted file mode 100644 index 19c0a7e5..00000000 --- a/example-cucumber2/src/main/java/com/epam/reportportal/example/cucumber2/Belly.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.epam.reportportal.example.cucumber2; - -public class Belly { - - private int satiation = 0; - - public void eat(int cukes) { - satiation += cukes; - } - - public void wait(int hours) { - if ((hours > 0) && (satiation > 0)) { - int utilized = 60 * hours; - if (utilized > satiation) { - utilized = satiation; - } - satiation -= utilized; - } - } - - public boolean growl() { - return satiation <= 0; - } -} diff --git a/example-cucumber2/src/main/java/com/epam/reportportal/example/cucumber2/reporter/ScenarioReporterTestCaseId.java b/example-cucumber2/src/main/java/com/epam/reportportal/example/cucumber2/reporter/ScenarioReporterTestCaseId.java deleted file mode 100644 index c0d6d2f0..00000000 --- a/example-cucumber2/src/main/java/com/epam/reportportal/example/cucumber2/reporter/ScenarioReporterTestCaseId.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2021 EPAM Systems - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.epam.reportportal.example.cucumber2.reporter; - -import com.epam.reportportal.cucumber.ScenarioReporter; -import com.epam.ta.reportportal.ws.model.StartTestItemRQ; -import cucumber.api.TestCase; -import cucumber.api.TestStep; - -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -/** - * A customized reporter which reports Scenarios as statistic items and a custom tag as Test Case ID - */ -public class ScenarioReporterTestCaseId extends ScenarioReporter { - - public static final String TAG_PREFIX = "@"; - 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 - @Override - protected StartTestItemRQ buildStartScenarioRequest(TestCase testCase, String name, String uri, int line) { - StartTestItemRQ rq = super.buildStartScenarioRequest(testCase, name, uri, line); - rq.getAttributes() - .stream() - .filter(a -> isNotBlank(a.getValue()) && a.getValue().startsWith(TAG_PREFIX + TEST_TRACKING_TICKET_PREFIX)) - .findAny() - .ifPresent(t -> rq.setTestCaseId(t.getValue() - .substring(TAG_PREFIX.length()))); // strip tag prefix to make Test Case ID equal to real ticket ID - return rq; - } - - // Removing Test Case ID from nested steps as redundant - @Override - protected StartTestItemRQ buildStartStepRequest(TestStep testStep, String stepPrefix, String keyword) { - StartTestItemRQ rq = super.buildStartStepRequest(testStep, stepPrefix, keyword); - rq.setTestCaseId(null); - return rq; - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunLoggingTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunLoggingTest.java deleted file mode 100644 index 61477787..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunLoggingTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.epam.reportportal.example.cucumber2; - -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; -import org.junit.runner.RunWith; - -@RunWith(Cucumber.class) -@CucumberOptions(plugin = { "pretty", - "com.epam.reportportal.cucumber.StepReporter" }, features = "src/test/resources/features/logging", tags = "~@ignore") -public class RunLoggingTest { -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunScenarioReporterTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunScenarioReporterTest.java deleted file mode 100644 index 65148ff4..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunScenarioReporterTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2021 EPAM Systems - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.epam.reportportal.example.cucumber2; - -import com.epam.reportportal.example.cucumber2.reporter.ScenarioReporterTestCaseId; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; -import org.junit.runner.RunWith; - -/** - * A JUnit runner for Cucumber which is using customized {@link ScenarioReporterTestCaseId} reporter. - */ -@RunWith(Cucumber.class) -@CucumberOptions(plugin = { "pretty", "com.epam.reportportal.example.cucumber2.reporter.ScenarioReporterTestCaseId" }, features = { - "src/test/resources/features/attribute" }, glue = { "com.epam.reportportal.example.cucumber2.attribute" }) -public class RunScenarioReporterTest { -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunStepReporterTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunStepReporterTest.java deleted file mode 100644 index e2975b3b..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/RunStepReporterTest.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.epam.reportportal.example.cucumber2; - -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; -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.cucumber2.attribute"}) -public class RunStepReporterTest { -} \ No newline at end of file diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/attribute/Stepdefs.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/attribute/Stepdefs.java deleted file mode 100644 index df072c83..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/attribute/Stepdefs.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.epam.reportportal.example.cucumber2.attribute; - -import com.epam.reportportal.annotations.attribute.Attribute; -import com.epam.reportportal.annotations.attribute.Attributes; -import com.epam.reportportal.annotations.attribute.MultiKeyAttribute; -import com.epam.reportportal.annotations.attribute.MultiValueAttribute; -import com.epam.reportportal.example.cucumber2.Belly; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; - -import static org.junit.Assert.assertTrue; - -public class Stepdefs { - - private Belly belly = new Belly(); - - @Attributes(attributes = { @Attribute(key = "key", value = "value") }) - @Given("^I have (\\d+) cukes in my belly$") - public void I_have_cukes_in_my_belly(int cukes) { - belly.eat(cukes); - } - - @Attributes(attributes = { @Attribute(key = "key1", value = "value1"), - @Attribute(key = "key2", value = "value2") }, multiKeyAttributes = { @MultiKeyAttribute(keys = { "k1", "k2" }, value = "v") }) - @When("^I wait (\\d+) hour$") - public void I_wait(int hours) { - belly.wait(hours); - } - - @Attributes(multiValueAttributes = { @MultiValueAttribute(isNullKey = true, values = { "v1", "v2" }) }) - @Then("^my belly should growl$") - public void my_belly_should_growl() { - assertTrue(belly.growl()); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/Hooks.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/Hooks.java deleted file mode 100644 index fe2821d1..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/Hooks.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import cucumber.api.java.After; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Arrays; -import java.util.List; - -public class Hooks { - private static final Logger LOGGER = LoggerFactory.getLogger(Hooks.class); - - private List storage; - - @Before - public void beforeScenario() { - LOGGER.info("Inside before"); - LOGGER.info("Initial storage state: {}", storage); - storage = Arrays.asList("one", "two"); - LOGGER.info("Storage is set to {}", storage); - } - - @Given("^I report scenario with hooks$") - public void test() { - LOGGER.info("Storage contains: {}", storage); - } - - @After - public void afterScenario() { - LOGGER.info("Inside after"); - LOGGER.info("Storage state: {}", storage); - storage = null; - LOGGER.info("Final storage state: {}", storage); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/LaunchLog.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/LaunchLog.java deleted file mode 100644 index e99899fd..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/LaunchLog.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import ch.qos.logback.classic.Level; -import com.epam.reportportal.example.cucumber2.util.Attachment; -import com.epam.reportportal.service.ReportPortal; -import cucumber.api.java.en.Given; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Date; -import java.util.Random; - -import static com.epam.reportportal.example.cucumber2.util.AttachmentHelper.FILE_NAME; -import static com.epam.reportportal.example.cucumber2.util.AttachmentHelper.getFileFromResources; - -/** - * @author Ihar Kahadouski - */ -public class LaunchLog { - - private static final Logger LOGGER = LoggerFactory.getLogger(LaunchLog.class); - - @Given("^I attach files to launch logs$") - public void iAttachFilesToLaunchLogs() { - LOGGER.info("I attach files to launch log"); - for (Attachment attachment : Attachment.values()) { - launchLogWithAttachment(randomLogLevel(), FILE_NAME, attachment); - } - } - - private static void launchLogWithAttachment(String level, String name, Attachment attachment) { - String message = String.format("LAUNCH LOG MESSAGE WITH %s ATTACHMENT", attachment.name()); - ReportPortal.emitLaunchLog(message, level, new Date(), getFileFromResources(name, attachment.getExtension())); - } - - private static String randomLogLevel() { - return Level.fromLocationAwareLoggerInteger(new Random().nextInt(5) * 10).toString(); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/LogLevelTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/LogLevelTest.java deleted file mode 100644 index 0e34c6e4..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/LogLevelTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import cucumber.api.java.en.Given; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LogLevelTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(LogLevelTest.class); - - @Given("Log level test") - public void logLevelTest() { - LOGGER.info("It is log level test"); - } - - @Given("I emit log on level info") - public void infoLevelTest() { - LOGGER.info("Info level test"); - } - - @Given("I emit log on level error") - public void errorLevelTest() { - LOGGER.error("Error level test"); - } - - @Given("I emit log on level debug") - public void debugLevelTest() { - LOGGER.debug("Debug level test"); - } - - @Given("I emit log on level warn") - public void warnLevelTest() { - LOGGER.warn("Warn level test"); - } - - @Given("I emit log on level trace") - public void traceLevelTest() { - LOGGER.trace("Trace level test"); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ParametersTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ParametersTest.java deleted file mode 100644 index eda52007..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ParametersTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertEquals; - -/** - * @author Ihar Kahadouski - */ -public class ParametersTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(ParametersTest.class); - private int itemsCount; - - @Given("^I have (\\d+) (.*) in my pocket$") - public void iHaveNumberItemInMyPocket(int number, String item) { - itemsCount = number; - LOGGER.info("I have {} {} in my pocket", number, item); - - } - - @When("^I eat one$") - public void iEatOne() { - itemsCount -= 1; - LOGGER.info("I eat one"); - } - - @Then("^I have (\\d+) in my pocket$") - public void iHaveResultInMyPocket(int result) { - assertEquals(result, itemsCount); - LOGGER.info("I have {} in my pocket", result); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportAttachmentsTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportAttachmentsTest.java deleted file mode 100644 index bb7cba39..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportAttachmentsTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import com.epam.reportportal.example.cucumber2.util.AttachmentHelper; -import com.epam.reportportal.example.cucumber2.util.LoggingUtils; -import com.epam.reportportal.example.cucumber2.util.MagicRandomizer; -import com.epam.reportportal.service.ReportPortal; -import com.epam.reportportal.utils.files.Utils; -import cucumber.api.java.en.Given; - -import java.io.*; -import java.util.Date; - -public class ReportAttachmentsTest { - public static final String FILE_FOLDER_PATH = "src/test/resources/files"; - public static final String XML_FILE_PATH = FILE_FOLDER_PATH + "/file.xml"; - public static final String JSON_FILE_PATH = FILE_FOLDER_PATH + "/file.json"; - - @Given("I attach logCss") - public void logCss() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.css"), "I'm logging CSS"); - } - - @Given("I attach logHtml") - public void logHtml() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.html"), "I'm logging HTML"); - } - - @Given("I attach logPdf") - public void logPdf() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.pdf"), "I'm logging PDF"); - } - - @Given("I attach logZip") - public void logZip() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.zip"), "I'm logging ZIP"); - } - - @Given("I attach logHar") - public void logHar() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.har"), "I'm logging HAR"); - } - - @Given("I attach logJavascript") - public void logJavascript() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.js"), "I'm logging JS"); - } - - @Given("I attach logPhp") - public void logPhp() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.php"), "I'm logging PHP"); - } - - @Given("I attach logPlain") - public void logPlain() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.txt"), "I'm logging TXT"); - } - - @Given("I attach logCsv") - public void logCsv() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.csv"), "I'm logging CSV"); - } - - @Given("I attach logCmd") - public void logCmd() { - LoggingUtils.log(new File(FILE_FOLDER_PATH + "/file.cmd"), "I'm logging CMD"); - } - - @Given("I attach logXmlBase64") - public void logXmlBase64() throws IOException { - /* here we are logging some binary data as BASE64 string */ - LoggingUtils.log(Utils.getFileAsByteSource(new File(XML_FILE_PATH)).read(), "I'm logging content via BASE64"); - } - - @Given("I attach logXmlFile") - public void logXmlFile() { - File file = AttachmentHelper.getFileFromResources(FILE_FOLDER_PATH, "file", "xml"); - LoggingUtils.log(file, "I'm logging content via temp file"); - } - - @Given("I attach logBase64") - public void logBase64() 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(FILE_FOLDER_PATH + "/file.css")); - LoggingUtils.log(Utils.getFileAsByteSource(new File(JSON_FILE_PATH)).read(), "I'm logging content via BASE64"); - } - - @Given("I attach logJsonFile") - public void logJsonFile() { - /* here we are logging some binary data as file (useful for selenium) */ - File file = AttachmentHelper.getFileFromResources(FILE_FOLDER_PATH, "file", "json"); - LoggingUtils.log(file, "I'm logging content via temp file"); - } - - @Given("I attach logImageBase64") - public void logImageBase64() throws IOException { - /* Generate 10 logs with pugs. Pug may be lucky or unlucky based on randomizer */ - for (int i = 0; i < 20; i++) { - /* 50 percents. So we should have approximately same count of lucky and unlucky pugs */ - boolean happy = MagicRandomizer.checkYourLucky(30); - String image = getImageResource(happy); - LoggingUtils.log(Utils.getFileAsByteSource(new File(image)).read(), "Pug is " + (happy ? "HAPPY" : "NOT HAPPY")); - } - } - - private String getImageResource(boolean lucky) { - return "src/test/resources/pug/" + (lucky ? "lucky.jpg" : "unlucky.jpg"); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportsStepWithDefectTest.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportsStepWithDefectTest.java deleted file mode 100644 index f01cd5e6..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportsStepWithDefectTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import cucumber.api.java.en.Given; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertEquals; - -public class ReportsStepWithDefectTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(ReportsStepWithDefectTest.class); - - @Given("Test is skipped") - public void testSkipped() { - LOGGER.info("I must be skipped"); - } - - @Given("^Test is failed$") - public void testFailure() { - assertEquals(2, 1); - } - - @Given("^Test is failed with message$") - public void testFailureWithMessage() { - assertEquals("Failure msg", 2, 1); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportsTestWithParameters.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportsTestWithParameters.java deleted file mode 100644 index 35f7f2a0..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/logging/ReportsTestWithParameters.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.epam.reportportal.example.cucumber2.logging; - -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ReportsTestWithParameters { - - private static final Logger LOGGER = LoggerFactory.getLogger(ReportsTestWithParameters.class); - - @Given("It is test with parameters") - public void infoLevel() { - LOGGER.info("It is test with parameters"); - } - - @When("^I have parameter (.*)$") - public void iHaveParameterStr(String str) { - LOGGER.info("String parameter {}", str); - } - - @Then("^I emit number (\\d+) on level info$") - public void infoLevel(int parameters) { - LOGGER.info("Test with parameters: " + parameters); - } - -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/Attachment.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/Attachment.java deleted file mode 100644 index f1a40b6b..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/Attachment.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.epam.reportportal.example.cucumber2.util; - -public enum Attachment { - CMD("cmd"), - CSS("css"), - CSV("csv"), - HAR("har"), - HTML("html"), - JPG("jpg"), - JS("js"), - JSON("json"), - PDF("pdf"), - PHP("php"), - PNG("png"), - TAR("tar"), - TAR_GZ("tar.gz"), - TXT("txt"), - XML("xml"), - ZIP("zip"); - - private final String extension; - - public String getExtension() { - return extension; - } - - Attachment(String extension) { - this.extension = extension; - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/AttachmentHelper.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/AttachmentHelper.java deleted file mode 100644 index 60b2b30e..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/AttachmentHelper.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.epam.reportportal.example.cucumber2.util; - -import com.epam.reportportal.utils.files.ByteSource; -import com.epam.reportportal.utils.files.Utils; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * Utility file to copy / read resource files. - */ -public class AttachmentHelper { - public static final String FILE_NAME = "file"; - - public static File getFileFromResources(String path, String name, String extension) { - File file = null; - try { - file = File.createTempFile("rp-test", "." + extension); - ByteSource source = Utils.getFileAsByteSource(new File(String.format("%s/%s.%s", path, name, extension))); - try (InputStream is = source.openStream()) { - try (OutputStream os = java.nio.file.Files.newOutputStream(file.toPath())) { - Utils.copyStreams(is, os); - } - } - } catch (IOException ignored) { - } - return file; - } - - public static File getFileFromResources(String name, String extension) { - return getFileFromResources("src/test/resources/files", name, extension); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/LoggingUtils.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/LoggingUtils.java deleted file mode 100644 index 90e282fc..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/LoggingUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.epam.reportportal.example.cucumber2.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.Base64; - -/** - * Useful utility class for binary data logging (e.g. sending files to ReportPortal). You can disable console output for - * `binary_data_logger` to avoid redundant verbose output. - */ -public class LoggingUtils { - - private static final Logger LOGGER = LoggerFactory.getLogger("binary_data_logger"); - - private LoggingUtils() { - //statics only - } - - public static void log(File file, String message) { - LOGGER.info("RP_MESSAGE#FILE#{}#{}", file.getAbsolutePath(), message); - } - - public static void logBase64(String base64, String message) { - LOGGER.info("RP_MESSAGE#BASE64#{}#{}", base64, message); - } - - public static void log(byte[] bytes, String message) { - logBase64(Base64.getEncoder().encodeToString(bytes), message); - } -} diff --git a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/MagicRandomizer.java b/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/MagicRandomizer.java deleted file mode 100644 index d6439b9d..00000000 --- a/example-cucumber2/src/test/java/com/epam/reportportal/example/cucumber2/util/MagicRandomizer.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.epam.reportportal.example.cucumber2.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Random; - -/** - * Just a randomizer - * - * @author Andrei Varabyeu - */ -public class MagicRandomizer { - - private static final Logger LOGGER = LoggerFactory.getLogger(MagicRandomizer.class); - - private static final Random RANDOM = new Random(); - private static final int UPPER_LIMIT = 100; - - private MagicRandomizer() { - //statics only - } - - public static int luckyInt(int bound) { - return RANDOM.nextInt(bound); - } - - /** - * Just put probability and check your luckiness - * - * @param probability value [0--100] - * @return TRUE if you are really lucky! - */ - public static boolean checkYourLucky(int probability) { - boolean lucky = luckyInt(UPPER_LIMIT + 1) <= probability; - LOGGER.debug("Generating [TRUE/FALSE] with probability {}%. Result {}", probability, lucky); - return lucky; - } -} diff --git a/example-cucumber2/src/test/resources/features/attribute/belly.feature b/example-cucumber2/src/test/resources/features/attribute/belly.feature deleted file mode 100644 index 86a8cb82..00000000 --- a/example-cucumber2/src/test/resources/features/attribute/belly.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Belly - - @ok - Scenario: a few cukes - Given I have 42 cukes in my belly - When I wait 1 hour - Then my belly should growl diff --git a/example-cucumber2/src/test/resources/features/logging/hooks.feature b/example-cucumber2/src/test/resources/features/logging/hooks.feature deleted file mode 100644 index 5eda247a..00000000 --- a/example-cucumber2/src/test/resources/features/logging/hooks.feature +++ /dev/null @@ -1,4 +0,0 @@ -Feature: Hooks reporting - - Scenario: Hooks - Given I report scenario with hooks \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/features/logging/launchLog.feature b/example-cucumber2/src/test/resources/features/logging/launchLog.feature deleted file mode 100644 index 23c068a8..00000000 --- a/example-cucumber2/src/test/resources/features/logging/launchLog.feature +++ /dev/null @@ -1,4 +0,0 @@ -Feature: Launch logging with attachments - - Scenario: Report launch with logs and attachment - Given I attach files to launch logs \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/features/logging/logLevelTest.feature b/example-cucumber2/src/test/resources/features/logging/logLevelTest.feature deleted file mode 100644 index 0b4ac1fb..00000000 --- a/example-cucumber2/src/test/resources/features/logging/logLevelTest.feature +++ /dev/null @@ -1,19 +0,0 @@ -Feature: LogLevelTest - - Background: Common information - Given Log level test - - Scenario: DebugLevelTest - Given I emit log on level debug - - Scenario: InfoLevelTest - Given I emit log on level info - - Scenario: TraceLevelTest - Given I emit log on level trace - - Scenario: WarnLevelTest - Given I emit log on level warn - - Scenario: ErrorLevelTest - Given I emit log on level error diff --git a/example-cucumber2/src/test/resources/features/logging/reportAttachmentsTest.feature b/example-cucumber2/src/test/resources/features/logging/reportAttachmentsTest.feature deleted file mode 100644 index 026e0207..00000000 --- a/example-cucumber2/src/test/resources/features/logging/reportAttachmentsTest.feature +++ /dev/null @@ -1,20 +0,0 @@ -Feature: ReportAttachmentsTest - - Background: - - Scenario: ReportAttachmentsTest - Given I attach logCmd - Given I attach logCss - Given I attach logCsv - Given I attach logHar - Given I attach logHtml - Given I attach logImageBase64 - Given I attach logJavascript - Given I attach logBase64 - Given I attach logJsonFile - Given I attach logPdf - Given I attach logPhp - Given I attach logPlain - Given I attach logXmlBase64 - Given I attach logXmlFile - Given I attach logZip diff --git a/example-cucumber2/src/test/resources/features/logging/reportsTestWithParametrs.feature b/example-cucumber2/src/test/resources/features/logging/reportsTestWithParametrs.feature deleted file mode 100644 index 1f968e4a..00000000 --- a/example-cucumber2/src/test/resources/features/logging/reportsTestWithParametrs.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Test with parameters - - Scenario Outline: Test with different parameters - Given It is test with parameters - When I have parameter - Then I emit number on level info - - Examples: - | str | parameters | - | first | 123 | - | second | 12345 | - | third | 12312345678 | - - Scenario Outline: Test with few parameter in method - Given I have in my pocket - When I eat one - Then I have in my pocket - - Examples: - | number | item | result | - | 100 | apples | 99 | - | 3 | cucumbers | 2 | - | 1 | cake | 0 | diff --git a/example-cucumber2/src/test/resources/features/logging/testWithDefects.feature b/example-cucumber2/src/test/resources/features/logging/testWithDefects.feature deleted file mode 100644 index 76af3902..00000000 --- a/example-cucumber2/src/test/resources/features/logging/testWithDefects.feature +++ /dev/null @@ -1,11 +0,0 @@ -Feature: Test with defects - - @ignore - Scenario: Test is skipped - Given Test is skipped - - Scenario: Test is failed - Given Test is failed - - Scenario: Test is failed with custom message - Given Test is failed with message diff --git a/example-cucumber2/src/test/resources/files/file.cmd b/example-cucumber2/src/test/resources/files/file.cmd deleted file mode 100644 index d64179c6..00000000 --- a/example-cucumber2/src/test/resources/files/file.cmd +++ /dev/null @@ -1,11 +0,0 @@ -title Batch File Testing -echo Hello World -echo. -echo Starting Notepad -start notepad -echo. -echo Starting Wordpad -start Wordpad -echo. -pause -exit \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/files/file.css b/example-cucumber2/src/test/resources/files/file.css deleted file mode 100644 index 67f6d90a..00000000 --- a/example-cucumber2/src/test/resources/files/file.css +++ /dev/null @@ -1,31 +0,0 @@ -p { - font-family: arial, helvetica, sans-serif; -} - -h2 { - font-size: 20pt; - color: red; - background: white; -} - -.note { - color: red; - background-color: yellow; - font-weight: bold; -} - -p#paragraph1 { - padding-left: 10px; -} - -a:hover { - text-decoration: none; -} - -#news p { - color: blue; -} - -[type="button"] { - background-color: green; -} \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/files/file.csv b/example-cucumber2/src/test/resources/files/file.csv deleted file mode 100644 index b1947884..00000000 --- a/example-cucumber2/src/test/resources/files/file.csv +++ /dev/null @@ -1,3 +0,0 @@ -1997,Ford,E350,"ac, abs, moon",3000.00 -1999,Chevy,"Venture ""Extended Edition""","",4900.00 -1996,Jeep,Grand Cherokee,"MUST SELL! air, moon roof, loaded",4799.00 \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/files/file.har b/example-cucumber2/src/test/resources/files/file.har deleted file mode 100644 index af497253..00000000 --- a/example-cucumber2/src/test/resources/files/file.har +++ /dev/null @@ -1,20 +0,0 @@ -{ - "log": { - "version": "1.2", - "creator": { - "name": "WebInspector", - "version": "537.36" - }, - "pages": [ - { - "startedDateTime": "2017-12-13T11:21:18.288Z", - "id": "page_2", - "title": "http://localhost:8080/", - "pageTimings": { - "onContentLoad": 330.9420000005048, - "onLoad": 464.73599999808357 - } - } - ] - } -} \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/files/file.html b/example-cucumber2/src/test/resources/files/file.html deleted file mode 100644 index 7e55dc92..00000000 --- a/example-cucumber2/src/test/resources/files/file.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - Office - - - - - - - - - -
-
- - - - - diff --git a/example-cucumber2/src/test/resources/files/file.jpg b/example-cucumber2/src/test/resources/files/file.jpg deleted file mode 100644 index 5d00e426..00000000 Binary files a/example-cucumber2/src/test/resources/files/file.jpg and /dev/null differ diff --git a/example-cucumber2/src/test/resources/files/file.js b/example-cucumber2/src/test/resources/files/file.js deleted file mode 100644 index 14272128..00000000 --- a/example-cucumber2/src/test/resources/files/file.js +++ /dev/null @@ -1,62 +0,0 @@ -var APP = APP || {}; -APP.Views.People = Backbone.View.extend({ - template: APP.getTemplate('people-list-template'), - initialize: function() { - this.render(); - var peopleControls = new APP.Views.PeopleControls({ - el: '#controls' - }); - var peopleInfo = new APP.Views.PeopleInfo({ - el: '#summary' - }); - this.showPeopleCount(); - this.listenTo(this.collection, 'reset', this.renderPeopleList); - this.listenTo(this.collection, 'all', this.showPeopleCount); - }, - events: { - 'click .toJSON': 'convertToJSON', - 'click .deleteAll': 'deleteAll', - 'click .addPerson': 'addPerson' - }, - convertToJSON: function() { - this.$('#JSON-output').html(JSON.stringify(this.collection.toJSON())); - }, - renderPerson: function(person) { - var personView = new APP.Views.Person({ - model: person, - //el: '#peopleList' затирает el при каждом вызове - }); - this.$el.find('#peopleList').append(personView.render().el); - }, - deleteAll: function() { - if (confirm('Delete all data?')) { - this.collection.reset(); - } - }, - addPerson: function() { - var personModel = new APP.Models.Person({ - 'name': this.$el.find('#name').val().trim(), - 'age': +this.$el.find('#age').val().trim(), - 'profession': this.$el.find('#profession > option:selected').text(), - }, { - validate: true - }); - if (!personModel.validationError) { - this.collection.add(personModel); - this.renderPerson(personModel); - } else { - alert(personModel.validationError); - } - }, - renderPeopleList: function() { - this.$el.find('#peopleList').html(''); - this.collection.each(this.renderCollection, this); - }, - showPeopleCount: function() { - this.$el.find('#peopleCount').html(this.collection.length); - }, - render: function() { - this.$el.html(this.template); - this.collection.each(this.renderPerson, this); - } -}); diff --git a/example-cucumber2/src/test/resources/files/file.json b/example-cucumber2/src/test/resources/files/file.json deleted file mode 100644 index bb5fa87f..00000000 --- a/example-cucumber2/src/test/resources/files/file.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "TFS": { - "build": { - "name": "TFS Service", - "description": "ReportPortal TFS Integration", - "version": "2.5.1.3-SNAPSHOT", - "branch": "HEAD-f649e1ccec66b7c7fd7a778768627c28e8ccbd2e" - } - }, - "GATEWAY": { - "build": { - "name": "Gateway Service", - "description": "ReportPortal Gateway Service", - "version": "3.0.0-SNAPSHOT", - "branch": "HEAD-705250f4b46b326fca66681a6de736a3889426a6" - } - }, - "UI": { - "build": { - "name": "UI Service", - "description": "ReportPortal User Interface", - "version": "2.7.1-SNAPSHOT", - "branch": "@branch@" - } - }, - "RALLY": { - "build": { - "name": "Rally Service", - "description": "ReportPortal Rally Integration", - "version": "2.7.1-SNAPSHOT", - "branch": "HEAD-5ced9894341c4188b467938ceb163a6c5244f558" - } - }, - "UAT": { - "build": { - "name": "Authorization Service", - "description": "Unified Authorization Trap for all ReportPortal's Services", - "version": "2.7.2-SNAPSHOT", - "branch": "HEAD-b3db18d8ca42ba4dc2cbe2a86d34808386931fc7" - }, - "auth_extensions": [ - "github" - ] - }, - "API": { - "build": { - "name": "API Service", - "description": "ReportPortal API Service", - "version": "3.0.0-SNAPSHOT", - "branch": "HEAD-52dedc065549a98951d9530ec8a80b0e51a72fe9" - } - }, - "JIRA": { - "build": { - "name": "Jira Service", - "description": "ReportPortal Jira Integration", - "version": "2.7.1-SNAPSHOT", - "branch": "HEAD-3d4da072d15049ef0137681e5da83fcb0f240c6e" - } - }, - "REGISTRY": { - "build": { - "name": "Registry Service", - "description": "ReportPortal Registry and Configuration Service", - "version": "2.7.2-SNAPSHOT", - "branch": "HEAD-a5bf296483928ec279eab67053c971edd6010fe8" - } - } -} diff --git a/example-cucumber2/src/test/resources/files/file.pdf b/example-cucumber2/src/test/resources/files/file.pdf deleted file mode 100644 index 9202d665..00000000 Binary files a/example-cucumber2/src/test/resources/files/file.pdf and /dev/null differ diff --git a/example-cucumber2/src/test/resources/files/file.php b/example-cucumber2/src/test/resources/files/file.php deleted file mode 100644 index fd5f2cde..00000000 --- a/example-cucumber2/src/test/resources/files/file.php +++ /dev/null @@ -1,23 +0,0 @@ -a = $a; - $this->b = $b; - } - - public function plus() - { - return $this->a + $this->b; - } -/* ............... */ -} - -$d = new C1(1, 2); -echo $d->plus(); // 3 -?> \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/files/file.png b/example-cucumber2/src/test/resources/files/file.png deleted file mode 100644 index 98998a52..00000000 Binary files a/example-cucumber2/src/test/resources/files/file.png and /dev/null differ diff --git a/example-cucumber2/src/test/resources/files/file.tar b/example-cucumber2/src/test/resources/files/file.tar deleted file mode 100644 index f794ff1a..00000000 Binary files a/example-cucumber2/src/test/resources/files/file.tar and /dev/null differ diff --git a/example-cucumber2/src/test/resources/files/file.tar.gz b/example-cucumber2/src/test/resources/files/file.tar.gz deleted file mode 100644 index c0eb1c5d..00000000 Binary files a/example-cucumber2/src/test/resources/files/file.tar.gz and /dev/null differ diff --git a/example-cucumber2/src/test/resources/files/file.txt b/example-cucumber2/src/test/resources/files/file.txt deleted file mode 100644 index 03871412..00000000 --- a/example-cucumber2/src/test/resources/files/file.txt +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2016 EPAM Systems -This file is part of EPAM Report Portal. -https://github.com/reportportal/service-ui -Report Portal is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. -Report Portal is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with Report Portal. If not, see . \ No newline at end of file diff --git a/example-cucumber2/src/test/resources/files/file.xml b/example-cucumber2/src/test/resources/files/file.xml deleted file mode 100644 index 2b8a2e1f..00000000 --- a/example-cucumber2/src/test/resources/files/file.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - Here is some xml content - diff --git a/example-cucumber2/src/test/resources/files/file.zip b/example-cucumber2/src/test/resources/files/file.zip deleted file mode 100644 index a46da2a9..00000000 Binary files a/example-cucumber2/src/test/resources/files/file.zip and /dev/null differ diff --git a/example-cucumber2/src/test/resources/logback.xml b/example-cucumber2/src/test/resources/logback.xml deleted file mode 100644 index c3d9ea93..00000000 --- a/example-cucumber2/src/test/resources/logback.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - %d{HH:mm:ss.SSS} %-5level %logger{5} - %thread - %msg%n - - - - - - - %d{HH:mm:ss.SSS} [%t] %-5level - %msg%n - [%t] - %msg%n - - - - - - - - - - - - - - - - diff --git a/example-cucumber2/src/test/resources/pug/lucky.jpg b/example-cucumber2/src/test/resources/pug/lucky.jpg deleted file mode 100644 index 5d00e426..00000000 Binary files a/example-cucumber2/src/test/resources/pug/lucky.jpg and /dev/null differ diff --git a/example-cucumber2/src/test/resources/pug/unlucky.jpg b/example-cucumber2/src/test/resources/pug/unlucky.jpg deleted file mode 100644 index 91e8af05..00000000 Binary files a/example-cucumber2/src/test/resources/pug/unlucky.jpg and /dev/null differ diff --git a/example-cucumber2/src/test/resources/reportportal.properties b/example-cucumber2/src/test/resources/reportportal.properties deleted file mode 100644 index 751b543c..00000000 --- a/example-cucumber2/src/test/resources/reportportal.properties +++ /dev/null @@ -1,6 +0,0 @@ -rp.endpoint=http://example.com -rp.api.key=api-key -rp.launch=launch-name -rp.project=project-name -rp.attributes=key:value;value -rp.reporting.async=true diff --git a/pom.xml b/pom.xml index 3fe30fea..c1cef881 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,6 @@ example-cucumber - example-cucumber2 example-cucumber4 example-cucumber6 example-cucumber6-testng