You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/report_generation.adoc
+83-25Lines changed: 83 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,33 +2,32 @@
2
2
3
3
=== Plain Text Reports
4
4
5
-
By default JGiven outputs plain text reports to the console when executed. To disable plain text reports set the following Java system property:
5
+
By default, JGiven outputs plain text reports to the console when executed. To disable plain text reports set the following Java system property:
6
6
7
-
[source,java]
7
+
[source,properties]
8
8
----
9
9
jgiven.report.text=false
10
10
----
11
11
12
12
=== JSON Reports
13
13
14
-
By default JGiven will generate JSON reports into the `jgiven-reports/json` directory. JGiven tries to autodetect when it is executed by the Maven surefire plugin and in that case generates the reports into `target/jgiven-reports/json`. To disable JSON report generation set the following Java system property:
14
+
By default, JGiven will generate JSON reports into the `jgiven-reports/json` directory. JGiven tries to autodetect when it is executed by the Maven surefire plugin and in that case generates the reports into `target/jgiven-reports/json`. To disable JSON report generation set the following Java system property:
15
15
16
-
[source,java]
16
+
[source,properties]
17
17
----
18
18
jgiven.report.enabled=false
19
19
----
20
20
21
21
[NOTE]
22
22
====
23
-
In order to generate HTML reports, JSON reports are required.
23
+
In order to generate HTML or AsciiDoc reports, JSON reports are required.
24
24
====
25
25
26
26
==== Change report directory
27
27
28
28
If you want to change the `jgiven-reports/json` directory, respectively `target/jgiven-reports/json`, set the following Java system property:
29
29
30
-
31
-
[source,java]
30
+
[source,properties]
32
31
----
33
32
jgiven.report.dir=<targetDir>
34
33
----
@@ -37,15 +36,18 @@ If JGiven is executed by the Maven surefire plugin, this can be done by the syst
37
36
38
37
[NOTE]
39
38
====
40
-
In case HTML Reports are being generated, the source directory for the JSON Reports needs to be set accordingly (see "HTML Report" for more).
39
+
In case HTML or AsciiDoc reports are being generated,
40
+
the source directory for the JSON reports needs to be set accordingly
41
+
(see <<HTML Report>> or <<AsciiDoc Report>> for more).
41
42
====
42
43
43
-
=== Dry Run
44
+
==== Dry Run
45
+
44
46
There is a dry run option, which just generates a report without actually
45
47
executing the code. This might be helpful to generate a test report quickly
46
48
without having to wait for the tests to be executed.
47
49
48
-
[source,java]
50
+
[source,properties]
49
51
----
50
52
jgiven.report.dry-run=true
51
53
----
@@ -65,19 +67,36 @@ The report generator can be executed on the command line as
65
67
follows (assuming that the `jgiven-core` and the `jgiven-html5-report` JAR
66
68
and all required dependencies are on the Java CLASSPATH)
To see the AsciiDoc report in action you can have a look at the
97
+
https://jgiven.org/jgiven-report/asciidoc/[AsciiDoc report of JGiven itself]
98
+
99
+
=== Maven Plugin
81
100
82
101
For Maven there exists a plugin that can be used as follows:
83
102
@@ -113,7 +132,7 @@ All of them are optional.
113
132
|Option |Description
114
133
115
134
|format
116
-
|The format of the generated report. Can be _html_or _text_. Default: _html_
135
+
|The format of the generated report. Can be _html_, _text_ or _asciidoc_. Default: _html_
117
136
118
137
|title
119
138
|The title of the generated report. Default: _JGiven Report_
@@ -137,14 +156,43 @@ All of them are optional.
137
156
138
157
Now run:
139
158
140
-
[source,bash]
159
+
[source,console]
141
160
----
142
161
$ mvn verify
143
162
----
144
163
145
-
HTML reports are then generated into the `target/jgiven-reports/html` directory. Note that the plugin relies on the existence of the JSON output, so if the property `jgiven.reports.enabled` was set to `false`, no output will be generated.
164
+
HTML reports are then generated into the `target/jgiven-reports/html` directory.
165
+
Note that the plugin relies on the existence of the JSON output,
166
+
so if the property `jgiven.reports.enabled` was set to `false`,
167
+
no output will be generated.
168
+
169
+
Use the following configuration to generate the AsciiDoc report instead of the HTML report.
There also exists a plugin for Gradle to make your life easier.
150
198
Add the following plugins section to your `build.gradle` file or extend the one you have already accordingly:
@@ -173,17 +221,19 @@ buildscript {
173
221
}
174
222
175
223
apply plugin: "com.tngtech.jgiven.gradle-plugin"
176
-
177
224
----
178
225
179
226
Now run:
180
227
181
-
[source,bash]
228
+
[source,console]
182
229
----
183
230
$ gradle test jgivenTestReport
184
231
----
185
232
186
-
HTML reports are then generated into the `build/reports/jgiven/test/html/` directory. Note that the plugin relies on the existence of the JSON output, so if the property `jgiven.reports.enabled` was set to `false`, no output will be generated.
233
+
HTML reports are then generated into the `build/reports/jgiven/test/html/` directory.
234
+
Note that the plugin relies on the existence of the JSON output,
235
+
so if the property `jgiven.reports.enabled` was set to `false`,
236
+
no output will be generated.
187
237
188
238
If you want that the HTML report is always generated after the tests
189
239
have been executed, you can configure the `test` task in your Gradle
0 commit comments