środa, 12 grudnia 2018

[QUICK TIP] Cucumber-java: how to configure reports for running tests locally in IDE (IntelliJ)

Sometimes, you need to run tests locally in your IDE. Having two kinds of reports (temporary and saved in file) is possible by configuring both console and "file" reports plugins.
One type of report is temporary console output. 
It needs "org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter" plugin ("Cucumber for java") to work fine. Its configuration is set in "Cucumber java" configuration runner after scenario or feature was run, in "Program arguments" row:

 --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter.

You can find it as follow:

Run  Edit Configurations → Cucumber java → name of test → Program arguments

Second type of report is "file" report.
It needs additionally configuration, when tests are running with context menu, not running directly runner class.
Its configuration you set in "Cucumber java" configuration runner after scenario or feature was run (or in cucumber runner template), in "Program arguments" row together with "CucumberJvm3SMFormatter" plugin. Simply type:

"--plugin pretty --plugin html:target/html"

All configuration in "Program arguments" row looks like below:

--plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter --plugin pretty --plugin html:target/html"

Report is created in "target" directory as html report with "pretty" (default for Cucumber) formatter plugin. You also get formatted test output in console.

Brak komentarzy:

Prześlij komentarz