2

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

biruk1230
3,1644 gold badges19 silver badges31 bronze badges
asked Jan 13, 2019 at 18:58
2
  • The first two things are not errors, but warnings, and these warnings can be safely ignored in the context of a Cucumber test. Commented Jan 13, 2019 at 19:06
  • Also, what language level is your project on? Commented Jan 13, 2019 at 19:07

1 Answer 1

0

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).

answered Jan 13, 2019 at 19:18
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.