Running Cucumber with Serenity feature files directly from IntelliJ

John Ferguson Smart | Mentor | Author | Speaker - Author of 'BDD in Action'.
Helping teams deliver more valuable software sooner6th September 2017

IntelliJ provides excellent integrated support for Cucumber feature files. You can even run features simply by right-clicking on the feature file. But this won't work when you are using Cucumber with Serenity, as Serenity needs to instrument the feature file before execution. Fortunately, this is easy to fix. Here's how:

  • Click on the feature file you want to run
  • In the Run menu Select Run...
  • In the contextual menu, select the feature, then "Edit..."
  • You should now see the 'Edit Configuration Settings' window. Set the main class to 'net.serenitybdd.cucumber.cli.Main'
  • Change the Glue field to the root package of your project (or of your step definitions)
  • Click Apply

Now you can run your feature directly by right-clicking on the feature file.

Have fun!

© 2019 John Ferguson Smart