1

I have a gradle + Serenity + RestAssured automated check suite setup that I usually run via gradle commands in shell sessions, but sometimes I need to run single Scenarios using IntelliJ.

When I run Scenarios on IntelliJ I usually get a lot of warnings like this one:

8312 [main] WARN cucumber.runtime.SerenityBackend - It looks like you are 
running a feature using @RunWith(Cucumber.class) 
instead of @RunWith(CucumberWithSerenity.class). 
Are you sure this is what you meant to do?

I'd like to know where and how I can configure the Run/Debug Configuration in IntelliJ in order to run the checks with the CucumberWithSerenity.class and fix the warning.

I'm using the following dependencies:

serenity-rest-assured:1.9.31
serenity-core:1.9.31
serenity-cucumber:1.9.12

IntelliJ version 2018.1.5 (Community Edition)

Filipe Freire
  • 823
  • 7
  • 21

1 Answers1

5

Below are the steps from John Ferguson Smart' blog, author of Serenity-BDD (considering that you have installed Cucumber for Java plugin).

Running Cucumber with Serenity feature files directly from IntelliJ:

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.

P.S. Not all versions of Cucumber for Java plugin works correctly, especially when you have just updated IntelliJ IDEA to the latest version. I can confirm that next setup works correctly:

  • IntelliJ IDEA 2018.2.3 (Community version);
  • Cucumber for Java plugion version 182.3934;
  • net.serenity-bdd:serenity-core:2.0.6;
  • net.serenity-bdd:serenity-cucumber:1.9.18
scormaq
  • 91
  • 4