Intellij IDEA Run configurations for Cucumber runner class

47,977

Solution 1

Provided that cucumber support is enabled you should be able to run the test from .feature file's context menu: enter image description here

Also in Run/Debug configurations window -> Cucumber java -> what should be the main class?

The class is taken from the jar archive attached when enabling Cucumber support in project. By default, the main class name is cucumber.cli.Main:

Run/Debug Configuration: Cucumber Java

Do not forget to specify the package where your step definitions are stored in the Glue filed of the Cucumber Run/Debug Configuration.

Solution 2

I changed the Main class in the configuration to io.cucumber.core.cli.Main worked for me.

Share:
47,977
ShuchiD
Author by

ShuchiD

Updated on August 12, 2021

Comments

  • ShuchiD
    ShuchiD over 2 years

    I am new to Intellij IDEA. I have a POM based cucumber-selenium project, where I've created cucumber runner classes for each feature file. While working with Eclipse I was able to execute these runner classes by Right click. However in Intellij IDEA (licensed version), even when cucumber-for-java and junit plugins are enabled in Settings window, I dont get Run option.

    Also in Run/Debug configurations window -> Cucumber java -> what should be the main class? My main class has code to launch firefox browser and is in different subpackage.

    If i mention "cucumber.cli.Main" in Main class, it gives me error - Could not find or load main class cucumber.cli.Main

    Please help.

    Thanks,

  • pedro_cze
    pedro_cze almost 4 years
    cucumber.api.cli.Main is deprecated (6/2020) use io.cucumber.core.cli.Main instead.
  • sɐunıɔןɐqɐp
    sɐunıɔןɐqɐp almost 4 years
    Hi, this post does not seem to provide a quality answer to the question. Please either edit your answer and improve it, or just post it as a comment to the question/other answer.
  • ennth
    ennth about 3 years
    THis doesn't work for me . It says 'cucumber' not found in the Module/classpath. I tried all the modules in my project and none of them work