You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When testing with Surefire using the `long` naming strategy the feature
name is included in every error message twice. This can be quite
annoying when the name is long. For example:
```
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.103 s <<< FAILURE! -- in io.cucumber.skeleton.RunCucumberTest
[ERROR] Belly.Belly - a few cukes -- Time elapsed: 0.060 s <<< FAILURE!
java.lang.AssertionError:
at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:11)
at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)
```
Like wise the xml report by Surefire includes the name twice.
```xml
<testcase name="Belly - a few cukes" classname="Belly" time="0.06">
<failure type="java.lang.AssertionError"><![CDATA[java.lang.AssertionError:
at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:11)
at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)
]]></failure>
```
By using the `cucumber.junit-platform.naming-strategy=surefire` property
when configuring surefire tests will look pretty in surefire too.
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<properties>
<!-- Work around. Surefire does not include enough
information to disambiguate between different
examples and scenarios. -->
<configurationParameters>
cucumber.junit-platform.naming-strategy=surefire
</configurationParameters>
</properties>
</configuration>
</plugin>
```
For example:
```
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.102 s <<< FAILURE! -- in io.cucumber.skeleton.RunCucumberTest
[ERROR] Belly.a few cukes -- Time elapsed: 0.059 s <<< FAILURE!
java.lang.AssertionError: TODO
at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:
```
And
```xml
<testcase name="a few cukes" classname="Belly" time="0.059">
<failure message="TODO" type="java.lang.AssertionError"><![CDATA[java.lang.AssertionError: TODO
at io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(StepDefinitions.java:10)
at ✽.I have 42 cukes in my belly(classpath:io/cucumber/skeleton/belly.feature:4)
]]></failure>
```
Copy file name to clipboardExpand all lines: cucumber-junit-platform-engine/src/main/java/io/cucumber/junit/platform/engine/DefaultNamingStrategyProvider.java
0 commit comments