I am having problems with defining the step and mapping it to the scenario. I have installed maven, set up the dependencies for java, and installed cucumber for java plugin altogether with external libraries in IntelliJ.
There are 3 errors occurred in this step: "Class Steps is never used" "Constructor Steps is never used" "Lambda expressions are not supported at language level"
What is the exact problem here?
import cucumber.api.PendingException;
public class Steps {
public Steps() {
Given("^I navigate to the login page$", () -> {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
});
}
}
This is the example of the Step which is created
-
The first two things are not errors, but warnings, and these warnings can be safely ignored in the context of a Cucumber test.Joe C– Joe C2019年01月13日 19:06:00 +00:00Commented Jan 13, 2019 at 19:06
-
Also, what language level is your project on?Joe C– Joe C2019年01月13日 19:07:05 +00:00Commented Jan 13, 2019 at 19:07
1 Answer 1
First two messages are just warnings - because you created Steps class, but didn't use it (and, of course, didn't use constructor of Steps class).
For the last one you need to change language level at least to 8.0 - Lambdas, type annotations etc. to allow lambda expressions usage (see this and this answers).