@@ -525,12 +525,29 @@ public void should_handle_one_step_at_the_time_execution() throws Exception {
525
525
assertXmlEqual (expected , actual );
526
526
}
527
527
528
+ @ Test
529
+ public void should_handle_empty_scenarios () throws Throwable {
530
+ CucumberFeature feature = TestHelper .feature ("path/test.feature" ,
531
+ "Feature: feature name\n " +
532
+ " Scenario: scenario name\n " );
533
+
534
+ String formatterOutput = runFeatureWithJUnitFormatter (feature );
535
+
536
+ String expected = "<?xml version=\" 1.0\" encoding=\" UTF-8\" standalone=\" no\" ?>\n " +
537
+ "<testsuite failures=\" 0\" name=\" cucumber.runtime.formatter.JUnitFormatter\" skipped=\" 1\" tests=\" 1\" time=\" 0\" >\n " +
538
+ " <testcase classname=\" feature name\" name=\" scenario name\" time=\" 0\" >\n " +
539
+ " <skipped message=\" The scenario has no steps\" />\n " +
540
+ " </testcase>\n " +
541
+ "</testsuite>\n " ;
542
+ assertXmlEqual (expected , formatterOutput );
543
+ }
544
+
528
545
@ Test
529
546
public void should_add_dummy_testcase_if_no_scenarios_are_run_to_aviod_failed_jenkins_jobs () throws Throwable {
530
547
CucumberFeature feature = TestHelper .feature ("path/test.feature" ,
531
548
"Feature: feature name\n " );
532
549
533
- String formatterOutput = runFeatureWithJUnitFormatter (feature , Collections .< String , String > emptyMap (), Collections .< SimpleEntry < String , String >> emptyList (), milliSeconds ( 1 ) );
550
+ String formatterOutput = runFeatureWithJUnitFormatter (feature );
534
551
535
552
String expected = "<?xml version=\" 1.0\" encoding=\" UTF-8\" standalone=\" no\" ?>\n " +
536
553
"<testsuite failures=\" 0\" name=\" cucumber.runtime.formatter.JUnitFormatter\" skipped=\" 0\" time=\" 0\" >\n " +
@@ -566,6 +583,10 @@ private File runFeaturesWithJunitFormatter(final List<String> featurePaths, bool
566
583
return report ;
567
584
}
568
585
586
+ private String runFeatureWithJUnitFormatter (final CucumberFeature feature ) throws Throwable {
587
+ return runFeatureWithJUnitFormatter (feature , new HashMap <String , String >(), 0L );
588
+ }
589
+
569
590
private String runFeatureWithJUnitFormatter (final CucumberFeature feature , final Map <String , String > stepsToResult , final long stepHookDuration )
570
591
throws Throwable {
571
592
return runFeatureWithJUnitFormatter (feature , stepsToResult , Collections .<SimpleEntry <String , String >>emptyList (), stepHookDuration );
0 commit comments