|
1 | 1 | package cucumber.runtime.formatter;
|
2 | 2 |
|
3 | 3 | import cucumber.api.Result;
|
| 4 | +import cucumber.runner.TimeService; |
4 | 5 | import cucumber.runtime.Backend;
|
5 | 6 | import cucumber.runtime.Runtime;
|
6 | 7 | import cucumber.runtime.RuntimeOptions;
|
@@ -116,8 +117,8 @@ public void should_format_skipped_scenario() throws Throwable {
|
116 | 117 |
|
117 | 118 | String stackTrace = getStackTrace(exception);
|
118 | 119 | String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
|
119 |
| - "<testsuite failures=\"0\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"1\" tests=\"1\" time=\"0.001\">\n" + |
120 |
| - " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.001\">\n" + |
| 120 | + "<testsuite failures=\"0\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"1\" tests=\"1\" time=\"0.003\">\n" + |
| 121 | + " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.003\">\n" + |
121 | 122 | " <skipped message=\"" + stackTrace.replace("\n\t", " 	") + "\"><![CDATA[" +
|
122 | 123 | "Given first step............................................................skipped\n" +
|
123 | 124 | "When second step............................................................skipped\n" +
|
@@ -148,8 +149,8 @@ public void should_format_pending_scenario() throws Throwable {
|
148 | 149 | String formatterOutput = runFeatureWithJUnitFormatter(feature, stepsToResult, stepDuration);
|
149 | 150 |
|
150 | 151 | String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
|
151 |
| - "<testsuite failures=\"0\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"1\" tests=\"1\" time=\"0.001\">\n" + |
152 |
| - " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.001\">\n" + |
| 152 | + "<testsuite failures=\"0\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"1\" tests=\"1\" time=\"0.003\">\n" + |
| 153 | + " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.003\">\n" + |
153 | 154 | " <skipped><![CDATA[" +
|
154 | 155 | "Given first step............................................................pending\n" +
|
155 | 156 | "When second step............................................................skipped\n" +
|
@@ -211,8 +212,8 @@ public void should_handle_failure_in_before_hook() throws Throwable {
|
211 | 212 | String formatterOutput = runFeatureWithJUnitFormatter(feature, stepsToResult, hooks, stepHookDuration);
|
212 | 213 |
|
213 | 214 | String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
|
214 |
| - "<testsuite failures=\"1\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"0\" tests=\"1\" time=\"0.001\">\n" + |
215 |
| - " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.001\">\n" + |
| 215 | + "<testsuite failures=\"1\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"0\" tests=\"1\" time=\"0.004\">\n" + |
| 216 | + " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.004\">\n" + |
216 | 217 | " <failure message=\"the stack trace\"><![CDATA[" +
|
217 | 218 | "Given first step............................................................skipped\n" +
|
218 | 219 | "When second step............................................................skipped\n" +
|
@@ -245,8 +246,8 @@ public void should_handle_pending_in_before_hook() throws Throwable {
|
245 | 246 | String formatterOutput = runFeatureWithJUnitFormatter(feature, stepsToResult, hooks, stepHookDuration);
|
246 | 247 |
|
247 | 248 | String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
|
248 |
| - "<testsuite failures=\"0\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"1\" tests=\"1\" time=\"0.001\">\n" + |
249 |
| - " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.001\">\n" + |
| 249 | + "<testsuite failures=\"0\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"1\" tests=\"1\" time=\"0.004\">\n" + |
| 250 | + " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.004\">\n" + |
250 | 251 | " <skipped><![CDATA[" +
|
251 | 252 | "Given first step............................................................skipped\n" +
|
252 | 253 | "When second step............................................................skipped\n" +
|
@@ -277,8 +278,8 @@ public void should_handle_failure_in_before_hook_with_background() throws Throwa
|
277 | 278 | String formatterOutput = runFeatureWithJUnitFormatter(feature, stepsToResult, hooks, stepHookDuration);
|
278 | 279 |
|
279 | 280 | String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
|
280 |
| - "<testsuite failures=\"1\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"0\" tests=\"1\" time=\"0.001\">\n" + |
281 |
| - " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.001\">\n" + |
| 281 | + "<testsuite failures=\"1\" name=\"cucumber.runtime.formatter.JUnitFormatter\" skipped=\"0\" tests=\"1\" time=\"0.004\">\n" + |
| 282 | + " <testcase classname=\"path/test.feature\" name=\"scenario name\" time=\"0.004\">\n" + |
282 | 283 | " <failure message=\"the stack trace\"><![CDATA[" +
|
283 | 284 | "Given first step............................................................skipped\n" +
|
284 | 285 | "When second step............................................................skipped\n" +
|
@@ -535,7 +536,7 @@ private File runFeaturesWithJunitFormatter(final List<String> featurePaths, bool
|
535 | 536 | RuntimeOptions runtimeOptions = new RuntimeOptions(args);
|
536 | 537 | Backend backend = mock(Backend.class);
|
537 | 538 | when(backend.getSnippet(any(PickleStep.class), anyString(), any(FunctionNameGenerator.class))).thenReturn("TEST SNIPPET");
|
538 |
| - final cucumber.runtime.Runtime runtime = new Runtime(resourceLoader, classLoader, asList(backend), runtimeOptions); |
| 539 | + final cucumber.runtime.Runtime runtime = new Runtime(resourceLoader, classLoader, asList(backend), runtimeOptions, new TimeService.Stub(0L), null); |
539 | 540 | runtime.run();
|
540 | 541 | return report;
|
541 | 542 | }
|
|
0 commit comments