From 1018dd1e517692d4f99ae813fb7b7c3eac82d172 Mon Sep 17 00:00:00 2001 From: Willy Aguirre Date: Sun, 2 Sep 2018 19:41:52 -0500 Subject: [PATCH] se agrega pruebas con klov --- .gitignore | 3 ++- browsertest/pom.xml | 12 ++++++++++++ .../src/test/java/com/web/RunCucumberTest.java | 2 +- .../src/test/java/com/web/Stepdefs.java | 18 ++++++++++++++++++ .../src/test/java/com/pruebas/Stepdefs.java | 6 +++--- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 50b86c9..6950dc2 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ hs_err_pid* *.iml -.idea \ No newline at end of file +.idea +target diff --git a/browsertest/pom.xml b/browsertest/pom.xml index e56411d..260d810 100644 --- a/browsertest/pom.xml +++ b/browsertest/pom.xml @@ -36,6 +36,18 @@ selenium-java 3.14.0 + + + com.aventstack + extentreports + 3.1.5 + + + + org.testng + testng + 6.14.3 + diff --git a/browsertest/src/test/java/com/web/RunCucumberTest.java b/browsertest/src/test/java/com/web/RunCucumberTest.java index 9d3ed53..8d82a71 100644 --- a/browsertest/src/test/java/com/web/RunCucumberTest.java +++ b/browsertest/src/test/java/com/web/RunCucumberTest.java @@ -5,6 +5,6 @@ import org.junit.runner.RunWith; @RunWith(Cucumber.class) -@CucumberOptions(plugin = {"pretty"}) +@CucumberOptions(plugin = {"pretty"}, glue = {"com.web"}) public class RunCucumberTest { } \ No newline at end of file diff --git a/browsertest/src/test/java/com/web/Stepdefs.java b/browsertest/src/test/java/com/web/Stepdefs.java index 4e58896..9348934 100644 --- a/browsertest/src/test/java/com/web/Stepdefs.java +++ b/browsertest/src/test/java/com/web/Stepdefs.java @@ -1,5 +1,7 @@ package com.web; +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.reporter.KlovReporter; import cucumber.api.java.After; import cucumber.api.java.Before; import cucumber.api.java.en.Given; @@ -15,11 +17,26 @@ public class Stepdefs { private WebDriver driver; + public static ExtentReports extentReports; @Before public void initWebDriver() { System.setProperty("webdriver.gecko.driver", "/Users/willyaguirre/Documents/opensource/geckodriver"); driver = new FirefoxDriver(); + + KlovReporter klovReporter = new KlovReporter(); + + klovReporter.initMongoDbConnection("localhost", 27017); + + klovReporter.setProjectName("SWTESTACADEMY"); + + klovReporter.setReportName("1.4"); + + klovReporter.setKlovUrl("http://localhost:9000"); + + extentReports = new ExtentReports(); + extentReports.attachReporter(klovReporter); + } @Given("^I am on the Google search page$") @@ -51,6 +68,7 @@ public Boolean apply(WebDriver d) { @After() public void closeBrowser() { driver.quit(); + extentReports.flush(); } } \ No newline at end of file diff --git a/pruebas/src/test/java/com/pruebas/Stepdefs.java b/pruebas/src/test/java/com/pruebas/Stepdefs.java index f9c9e1d..e9cf7c8 100644 --- a/pruebas/src/test/java/com/pruebas/Stepdefs.java +++ b/pruebas/src/test/java/com/pruebas/Stepdefs.java @@ -1,10 +1,10 @@ package com.pruebas; -import cucumber.api.PendingException; import cucumber.api.java.en.Given; -import cucumber.api.java.en.When; import cucumber.api.java.en.Then; -import static org.junit.Assert.*; +import cucumber.api.java.en.When; + +import static org.junit.Assert.assertEquals; class IsItFriday { static String isItFriday(String today) {