4
votes

IntelliJ
Java
Cucumber

After upgrading to the latest Cucumber version, my tests are no longer running. I've been going back and forth here, and verified without a doubt that the problems arrive after the Cucumber upgrade.

When trying to rund a Cucumber test scenario locally in IntelliJ, I get the following:

No tests were found

And the following warnings and errors:

Aug 28, 2019 10:02:00 AM cucumber.api.cli.Main run
WARNING: You are using deprecated Main class. Please use  io.cucumber.core.api.cli.Main
Aug 28, 2019 10:02:02 AM cucumber.runtime.Runtime run
SEVERE: Exception while executing pickle
java.util.concurrent.ExecutionException:  
java.lang.IncompatibleClassChangeError: Found interface cucumber.api.TestCase, but class was expected 
    at cucumber.runtime.Runtime.run(Runtime.java:114)
    at io.cucumber.core.cli.Main.run(Main.java:43)
    at cucumber.api.cli.Main.run(Main.java:28)
    at cucumber.api.cli.Main.main(Main.java:15)

This only hapens when I try to run test scenarios directly/manually. That is, right-click the scenario and select "Run" or "Debug." If I run my CucumberTest.java file it works.

I've cleared the cache and restarted, with no change. I've also changed the imports in my CucumberTest class:

//import cucumber.api.CucumberOptions;
import io.cucumber.junit.CucumberOptions;
//import cucumber.api.junit.Cucumber;
import io.cucumber.junit.Cucumber;

Any ideas? I realize that the error message means that something has changed from compile time to run time, and that something seems to be that cucumber.api.TestCase goes from a class to and interface. But I cannot make any sense of it, nor find where this apparently happens.

1
Are you using a runner class for your tests? - Mate Mrše
Did you update IDEA and the cucumber plugin? - M.P. Korstanje
Yup. No missing updates according to the overview. - Hfrav

1 Answers

0
votes

I had similar problems using IntelliJ, Java, Cucumber on Windows. There is a bug report at JetBrains that suggests working around the issue by running the tests while setting the Shorten command line option to JAR manifest. This worked for me!

https://youtrack.jetbrains.com/issue/IDEA-220676