vendredi 30 mars 2018

can't runing testNG or JUnit test

i worked in project witch i implemented a simple feature, stepdefinition class and the runner and want to test it using testJUnit or when i run TestNG.xml.

but i have this problem

You can implement missing steps with the snippets below:

@Given("^sample feature file is ready$")
public void sample_feature_file_is_ready() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@When("^I run the feature file$")
public void i_run_the_feature_file() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^run should be successful$")
public void run_should_be_successful() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

my feature is :

@smokeTest
Feature: To test my cucumber test is running
I want to run a sample feature file.

Scenario: cucumber setup

Given sample feature file is ready
When I run the feature file
Then run should be successful

My stepdefinition is :

public class Test_Steps {

      @Given("^sample feature file is ready$")
      public void givenStatment(){
            System.out.println("Given statement executed successfully");
      }

      @When("^I run the feature file$")
      public void whenStatement(){
         System.out.println("When statement execueted successfully");
      }

     @Then("^run should be successful$")
      public void thenStatment(){
         System.out.println("Then statement executed successfully");
      }

My runner is :

@RunWith(Cucumber.class) @CucumberOptions(

     features = {"D:\\feat\\user"},
     glue={"stepsdef"},
     tags= "@smokeTest")
public class RunnerTestInChrome extends AbstractTestNGCucumberTests {

}

how can i know that the stepdefinition class is related to my features! i don't understand the problem i implemented the methods scripts

Aucun commentaire:

Enregistrer un commentaire