diff --git a/examples/maven/pom.xml b/examples/maven/pom.xml new file mode 100644 index 0000000..8c4e80a --- /dev/null +++ b/examples/maven/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + com.sitture + cucumber-jvm-extentreport-maven-example + jar + 1.0.0-SNAPSHOT + A maven example for the custom cucumber-jvm formatter using ExtentReports + + + UTF-8 + UTF-8 + 2.0.3-SNAPSHOT + 3.0.7 + 3.7.0 + 1.8 + + + + + MIT License + http://www.opensource.org/licenses/mit-license.php + repo + + + + + + com.sitture + cucumber-jvm-extentreport + ${cucumber-jvm-extentreport.version} + + + com.aventstack + extentreports + ${extentreports.version} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + + diff --git a/examples/maven/src/test/java/com/sitture/RunCukesTest.java b/examples/maven/src/test/java/com/sitture/RunCukesTest.java new file mode 100644 index 0000000..c43537b --- /dev/null +++ b/examples/maven/src/test/java/com/sitture/RunCukesTest.java @@ -0,0 +1,25 @@ +package com.sitture; + +import cucumber.api.CucumberOptions; +import cucumber.api.SnippetType; +import cucumber.api.junit.Cucumber; +import org.junit.AfterClass; +import org.junit.runner.RunWith; + +@RunWith(Cucumber.class) +@CucumberOptions( + features = {"src/test/resources"}, + snippets = SnippetType.CAMELCASE, + plugin = {"com.sitture.ExtentFormatter:target/output/extent-report/index.html", "html:target/output/html-report"} +) +public class RunCukesTest { + + @AfterClass + public static void setup() { + ExtentReporter.setConfig("src/test/resources/config.xml"); + ExtentReporter.setSystemInfo("Browser", "Chrome"); + ExtentReporter.setSystemInfo("Selenium", "v2.53.1"); + } + +} + diff --git a/examples/maven/src/test/java/com/sitture/definitions/StepDefinitions.java b/examples/maven/src/test/java/com/sitture/definitions/StepDefinitions.java new file mode 100644 index 0000000..8dc3cbf --- /dev/null +++ b/examples/maven/src/test/java/com/sitture/definitions/StepDefinitions.java @@ -0,0 +1,22 @@ +package com.sitture.definitions; + +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; + +public class StepDefinitions { + @Given("^I have (\\d+) cukes in my belly$") + public void iHaveCukesInMyBelly(int cukes) throws Throwable { + System.out.format("Cukes: %d\n", cukes); + } + + @Then("^I print out the results$") + public void iPrintOutTheResults() throws Throwable { + // Write code here that turns the phrase above into concrete actions + } + + @Given("^I have (\\d+) cukes in my bellies$") + public void iHaveCukesInMyBellies(int cukes) throws Throwable { + System.out.format("Cukes: %d\n", cukes); + } + +} diff --git a/examples/maven/src/test/resources/config.xml b/examples/maven/src/test/resources/config.xml new file mode 100644 index 0000000..ed308b6 --- /dev/null +++ b/examples/maven/src/test/resources/config.xml @@ -0,0 +1,15 @@ + + + + + standard + + UTF-8 + + Test Results + Test Results + - v1.0.0 + + dd-MM-yyyy + + \ No newline at end of file diff --git a/examples/maven/src/test/resources/cucumber/feature_one.feature b/examples/maven/src/test/resources/cucumber/feature_one.feature new file mode 100644 index 0000000..ffb50d7 --- /dev/null +++ b/examples/maven/src/test/resources/cucumber/feature_one.feature @@ -0,0 +1,17 @@ +@feature_one +Feature: My First Feature + + @scenario_one + Scenario Outline: My First Scenario + Given I have cukes in my belly + Then I print out the results + + Examples: + | test | + | 1 | + | 2 | + + @scenario_two + Scenario: My Second Scenario + Given I have 7 cukes in my bellies + Then I print out the results \ No newline at end of file diff --git a/examples/maven/src/test/resources/cucumber/feature_two.feature b/examples/maven/src/test/resources/cucumber/feature_two.feature new file mode 100644 index 0000000..d8d92a1 --- /dev/null +++ b/examples/maven/src/test/resources/cucumber/feature_two.feature @@ -0,0 +1,8 @@ +Feature: Second Feature + + Scenario: My First Scenario + Given I have 10 cukes in my belly + Then I print out the results + + Scenario: My Second Scenario + Given I have 7 cukes in my bellies \ No newline at end of file