Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IncompatibleClassChangeError running Cucumber tests in IntelliJ

When I run a cucumber test feature in IntelliJ, all it shows is an IncompatibleClassChangeError with stack trace:

Testing started at 12:55 ...
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java ...
Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface cucumber.api.TestCase, but class was expected
    at org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter.handleTestCaseStarted(CucumberJvm2SMFormatter.java:80)
    at org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter.access$000(CucumberJvm2SMFormatter.java:17)
    at org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter$1.receive(CucumberJvm2SMFormatter.java:32)
    at org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter$1.receive(CucumberJvm2SMFormatter.java:30)
    at cucumber.runner.EventBus.send(EventBus.java:28)
    at cucumber.runner.TestCase.run(TestCase.java:37)
    at cucumber.runner.Runner.runPickle(Runner.java:44)
    at cucumber.runtime.Runtime.runFeature(Runtime.java:120)
    at cucumber.runtime.Runtime.run(Runtime.java:106)
    at cucumber.api.cli.Main.run(Main.java:35)
    at cucumber.api.cli.Main.main(Main.java:18)

Process finished with exit code 1
Empty test suite.

This is IntelliJ IDEA 2018.1.4 (Ultimate Edition), Build #IU-181.5087.20, with Cucumber for Java version 181.5087.20

like image 634
beetstra Avatar asked May 24 '18 11:05

beetstra


People also ask

How do I run Cucumber test cases in Intellij?

From the main menu, select Run | Edit Configurations. or press Alt+Insert and select Cucumber Java from the list. After that, you can complete the configuration using the options on the right. For the description of each option, refer to Run/Debug Configuration: Cucumber Java.

Which runner runs scenarios with Cucumber JVM?

Maven can automatically run Cucumber-JVM tests as part of the build process.


1 Answers

As explained in issue #1392

This is caused by IDEA's CucumberJvm2SMFormatter. It being the formatter for Cucumber2, runs into a breaking change in Cucumber 3.

The simplest workaround is removing --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter from program arguments in the run configuration.

like image 199
Yilmaz Guleryuz Avatar answered Sep 28 '22 20:09

Yilmaz Guleryuz