Cucumber dependency for using Lambda expressions in Java 8

In Java 8, Lambda expressions were introduced. Cucumber allows you to write step definitions using Lambda expressions.

You need to add below dependency to write tests using Lambda expressions.

<dependency>
          <groupId>info.cukes</groupId>
          <artifactId>cucumber-java8</artifactId>
          <version>1.2.4</version>
          <scope>test</scope>
</dependency>

Ensure that JDK version is 1.8.0_51. Otherwise you will get below error.

Exception in thread “main” cucumber.runtime.CucumberException: Failed to instantiate class …….CucumberException: java.lang.IllegalArgumentException: Wrong type at constant pool index

 

You may also like...