Skip to content

Commit ebfb7aa

Browse files
committed
Add tests for the JUnitFormatter to disclose issues
The main issue is that the JUnitFormatter does not handle failures in the before and after hooks properly. To add flexibility the tests also specify that the JUnitFormatter should handle both all-steps-first execution and one-step-at-the-time execution.
1 parent 87b2ee4 commit ebfb7aa

File tree

4 files changed

+468
-1
lines changed

4 files changed

+468
-1
lines changed

core/src/main/java/cucumber/runtime/formatter/JUnitFormatter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class JUnitFormatter implements Formatter, Reporter, StrictAware {
4646

4747
public JUnitFormatter(URL out) throws IOException {
4848
this.out = new UTF8OutputStreamWriter(new URLOutputStream(out));
49+
TestCase.treatSkippedAsFailure = false;
4950
try {
5051
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
5152
rootElement = doc.createElement("testsuite");

core/src/test/java/cucumber/runtime/TestHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@Ignore
1414
public class TestHelper {
15-
static CucumberFeature feature(final String path, final String source) throws IOException {
15+
public static CucumberFeature feature(final String path, final String source) throws IOException {
1616
ArrayList<CucumberFeature> cucumberFeatures = new ArrayList<CucumberFeature>();
1717
FeatureBuilder featureBuilder = new FeatureBuilder(cucumberFeatures);
1818
featureBuilder.parse(new Resource() {

0 commit comments

Comments
 (0)