sebaslogen / CleanGUITestArchitecture

Sample project of Android GUI test automation using Espresso, Cucumber and the Page Object Pattern
MIT License
137 stars 31 forks source link

Getting pending exception when i run my runner file in cucumber #27

Open aranip opened 4 years ago

aranip commented 4 years ago

Here is the error stack trace: cucumber.api.PendingException: TODO: implement me at cucumber.runtime.junit.JUnitReporter.addFailure(JUnitReporter.java:150) at cucumber.runtime.junit.JUnitReporter.addFailureOrIgnoreStep(JUnitReporter.java:138) at cucumber.runtime.junit.JUnitReporter.result(JUnitReporter.java:98) at cucumber.runtime.Runtime.runStep(Runtime.java:282) at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:102) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at cucumber.runtime.junit.ExamplesRunner.run(ExamplesRunner.java:59) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at cucumber.runtime.junit.ScenarioOutlineRunner.run(ScenarioOutlineRunner.java:53) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:95) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:38) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at cucumber.api.junit.Cucumber.run(Cucumber.java:100) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Here is my Runner file: import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class) @CucumberOptions( features = "/Users/amruthapenigalapati/eclipse-workspace/corejava/src/Basic_java/CucumberWithJunit/src/test/java/features/Login.feature", //the path of the feature files glue={"stepDefinitions.LoginStep"}, //the path of the step definition files plugin = {"pretty","html:test-outout", "json:json_output/cucumber.json", "junit:junit_xml/cucumber.xml"}, //to generate different types of reporting monochrome = true, //display the console output in a proper readable format strict = true //it will check if any step is not defined in step definition file //dryRun = false //to check the mapping is proper between feature file and step def file ) public class TestRunner {

}

Here is my feature file: Feature: Ecommerce Application Test

Scenario Outline: Validate Ecommerce Login Page Test

Given ecomm user enters the url When ecomm user enters the login details "" and "" Then user logs in successfully

Examples: | UserName | Password | | harikaqa.601@gmail.com | Welcome@123 | |chitraaaaaaa@gmail.com | chitra12112312 |

Here is my step definition file:

import org.junit.Assert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver;

import core.ApexBaseTest; import core.EcommerceConstants; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When;

public class LoginStep extends ApexBaseTest implements EcommerceConstants{ static WebDriver driver; @Given("^ecomm user enters the url$") public static void ecomm_user_enters_the_url() throws Throwable { ApexBaseTest.setup(); Assert.assertEquals("Welcome to Ez Shop Online" , TITLE); driver.findElement(By.linkText("ACCOUNT")).click();

}
@When("^ecomm user enters the login details \"([^\"]*)\" and \"([^\"]*)\"$")
public static void ecomm_user_enters_the_login_details(String UserName, String Password) throws Throwable {
    driver.findElement(By.name(EMAIL_NAME_LOCATOR)).sendKeys(UserName);
    driver.findElement(By.name(PWD_NAME_LOCATOR)).sendKeys(Password);  
    driver.findElement(By.xpath("/html/body/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr[4]/td[2]/form/table/tbody/tr[5]/td/a/div")).click();
}
@Then("^user logs in successfully$")
public void user_logs_in_successfully() throws Throwable {
    Assert.assertEquals("You have Logged In successfully.",TITLE2);

}

}

aranip commented 4 years ago

can you please help me out with this issue

sebaslogen commented 4 years ago

Your exception on the first line says "TODO: implement me" so it means you have a TODO somewhere. If you can't find any TODO with this message in your code, then my only guess is that the regular expression that you are using to parse username and password is failing and the sentence in the feature file is unrecognized. Try running only the first sentence of your feature file to see if the problem is in the second one.

Good luck