Commit d77dd29
committed
Support configurable NamingStrategy.ExampleName
For example:
```java
public final class MyJUnitXmlFormatter implements ConcurrentEventListener {
private final MessagesToJunitXmlWriter writer;
public JUnitFormatter(OutputStream out) {
this.writer = new MessagesToJunitXmlWriter(NamingStrategy.ExampleName.PICKLE, out);
}
@OverRide
public void setEventPublisher(EventPublisher publisher) {
publisher.registerHandlerFor(Envelope.class, this::write);
}
private void write(Envelope event) {
try {
writer.write(event);
} catch (IOException e) {
throw new IllegalStateException(e);
}
if (event.getTestRunFinished().isPresent()) {
try {
writer.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}
}
```
Note: Cucumber-JVM at present doesn't allow much configuration of plugins.
To take advantage of this new option, the class above must be copied. And
can be used in Cucumber-JVM with
`cucumber.plugin=com.example.MyJUnitXmlFormatter:target/report.xml`.
Fixes: #271 parent b389855 commit d77dd29
File tree
3 files changed
+24
-7
lines changed- java/src/main/java/io/cucumber/junitxmlformatter
3 files changed
+24
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
27 | 43 | | |
28 | 44 | | |
29 | 45 | | |
| |||
Lines changed: 5 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 34 | + | |
40 | 35 | | |
41 | 36 | | |
42 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
0 commit comments