Run Cucumber feature files via IntelliJ

[main] ERROR net.thucydides.core.steps.StepEventBus – No base step listener registered – this is generally a bad sign.

Base step listener not registered

This error occurs when you are trying to run Cucumber .feature test cases from IntelliJ.


[main] ERROR net.thucydides.core.steps.StepEventBus - No base step listener registered - this is generally a bad sign.

Step failed
java.lang.NullPointerException: No BaseStepListener has been registered
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:900)
	at net.thucydides.core.steps.StepEventBus.getBaseStepListener(StepEventBus.java:137)
	at cucumber.runtime.SerenityObjectFactory.newInstance(SerenityObjectFactory.java:77)
	at cucumber.runtime.SerenityObjectFactory.cacheNewInstance(SerenityObjectFactory.java:58)
	at cucumber.runtime.SerenityObjectFactory.getInstance(SerenityObjectFactory.java:48)
	at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
	at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:29)
	at io.cucumber.core.runner.CoreStepDefinition.execute(CoreStepDefinition.java:66)
	at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
	at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
	at io.cucumber.core.runner.TestStep.run(TestStep.java:63)
	at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:49)
	at io.cucumber.core.runner.TestCase.run(TestCase.java:99)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:71)
	at io.cucumber.core.runtime.Runtime.lambda$execute$5(Runtime.java:110)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
	at io.cucumber.core.runtime.Runtime.lambda$execute$6(Runtime.java:110)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at io.cucumber.core.runtime.Runtime$SameThreadExecutorService.execute(Runtime.java:233)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
	at io.cucumber.core.runtime.Runtime.lambda$run$2(Runtime.java:86)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.SliceOps$1$1.accept(SliceOps.java:204)
	at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1361)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at io.cucumber.core.runtime.Runtime.run(Runtime.java:87)
	at io.cucumber.core.cli.Main.run(Main.java:79)
	at io.cucumber.core.cli.Main.main(Main.java:33)

IntelliJ is smart enough to include all the plugins that you’ll require for your project, but still, if you are not able to run the feature files from IntelliJ then it means there is a configuration issue.

To move fast with this tutorial you can download/clone the ready-to-run Cucumber project from here. It contains Feature files, Step definitions, Data Driven Testsand Reporting Download

Now here is the step by step approach that you need to follow in order to run the cucumber features via IntelliJ
  1.  Go to Run > Edit Configurations
  2.  In the run configurations select Cucumber Java
  3. In the next window
    • Main class: net.serenitybdd.cucumber.cli.Main
    • Glue: org.example.steps // this is your package containing step definitions, change it as per your project
    • Feature or folder path:C:/GitHub/dataDrivenCucumberTests/src/test/resources/features/dataDriven/dataDrivenTests.feature // this is path of your feature file
    • Program arguments: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter
    • Working directory: $MODULE_WORKING_DIR$
    • Use classpath of module: dataDrivenCucumberTests

Once you are done, it will look like the one below.

Then click Apply and OK

and try running your tests again.

Run Cucumber tests via IntelliJ

Thank you for reading, see you in the next one.

Add a Comment

Your email address will not be published. Required fields are marked *