lundi 27 novembre 2017

I've set up a simple automation framework in Eclipse using Java but cannot run cucumber tests via junit. Can anyone help please?

I'm new to cucumber and java (come from a specflow/c# background). I am trying to set up my 1st project in eclipse and think everything is set up correctly (my step definition file can be accessed (using F3 - go to definition) from the feature file).

I have set up a testrunner file like so:


package cucumberTest;

import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "Feature"
        ,tags = "@LoginTests"
        ,glue={"src/stepDefinition"}
        ,dryRun = true
        ,monochrome = true
        )

public class TestRunner {
}


My issue is that when I run junit (v4.11) via eclipse ide, the tests do not run , I get told the scenarios and steps are undefined and am given suggestions to fix the issue:


2 Scenarios (2 undefined)

6 Steps (6 undefined)

0m0.105s

You can implement missing steps with the snippets below:

Given("^User is on Home Page$", () -> {

    //Write code here that turns the phrase above into concrete actions

throw new PendingException();

});


However, the syntax suggested to me is incorrect. Any ideas why the syntax is wrong and why my tests do not run?

Aucun commentaire:

Enregistrer un commentaire