Skip to content

Commit 9114f7c

Browse files
committed
Updated hello world example
1 parent bc3692d commit 9114f7c

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

examples/java-helloworld/README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ kicks off Cucumber.
3030
The Cucumber runtime parses command line options to know what features to run, where the glue code lives, what formatters to use etc.
3131
When you use the JUnit runner, these options are generated from the `@Cucumber.Options` annotation on your test.
3232

33-
Sometimes it can be useful to override these options without changing the JUnit class. This can be done with the `cucumber.options` system property. If it is specified it will override *all* options. Here is an example:
33+
Sometimes it can be useful to override these options without changing or recompiling the JUnit class. This can be done with the
34+
`cucumber.options` system property. Here are a couple of examples:
35+
36+
With Maven:
3437

3538
```
36-
mvn test -Dcucumber.options="--format json-pretty --glue classpath:cucumber/examples/java/helloworld src/test/resources"
39+
mvn -Dcucumber.options="--format junit:target/cucumber-junit-report.xml" test
3740
```
3841

42+
Or with Ant:
43+
44+
```
45+
_JAVA_OPTIONS='-Dcucumber.options="--format json-pretty:target/cucumber-json-report.json"' ant runcukes
46+
```

examples/java-helloworld/build.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<property name="cucumber-html.version" value="0.2.2"/>
55
<property name="jchronic.version" value="0.2.6"/>
66
<property name="junit.version" value="4.11"/>
7-
87
<property name="jars" value="lib"/>
98

109
<target name="download">
@@ -48,7 +47,7 @@
4847
<java classname="cucumber.api.cli.Main" fork="true" failonerror="false" resultproperty="cucumber.exitstatus">
4948
<classpath refid="classpath"/>
5049
<arg value="--format"/>
51-
<arg value="junit:target/cucumber-junit-report/allcukes.xml"/>
50+
<arg value="junit:target/cucumber-junit-report.xml"/>
5251
<arg value="--format"/>
5352
<arg value="pretty"/>
5453
<arg value="--format"/>
@@ -59,8 +58,8 @@
5958
</java>
6059

6160
<junitreport todir="target/cucumber-junit-report">
62-
<fileset dir="target/cucumber-junit-report">
63-
<include name="allcukes.xml"/>
61+
<fileset dir="target">
62+
<include name="cucumber-junit-report.xml"/>
6463
</fileset>
6564
<report format="frames" todir="target/cucumber-junit-report"/>
6665
</junitreport>

examples/java-helloworld/src/test/java/cucumber/examples/java/helloworld/RunCukesTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
import org.junit.runner.RunWith;
55

66
@RunWith(Cucumber.class)
7-
@Cucumber.Options(format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target/cucumber-report.json"})
7+
@Cucumber.Options(format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target/cucumber-json-report.json"})
88
public class RunCukesTest {
99
}

0 commit comments

Comments
 (0)