Skip to content

Commit 43c87b2

Browse files
doc: JSON formatter
1 parent 1eaec2d commit 43c87b2

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

user_guide/command_line_tool/formatting.rst

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ Behat supports 3 formatters out of the box:
2727

2828
* ``junit`` - prints the output to xml files in the standard junit.xml format
2929

30+
* ``json`` - prints the output to a json file in json format.
31+
32+
You can see the schema of this json file in the `Schema`_ definition in GitHub
33+
3034
If you don't want to print output to the console, you can tell Behat
3135
to print output to a file instead of ``STDOUT`` with the ``--out`` option:
3236

@@ -36,9 +40,11 @@ to print output to a file instead of ``STDOUT`` with the ``--out`` option:
3640
3741
.. note::
3842

39-
Some formatters, like ``junit``, always require the ``--out`` option to be
43+
Some formatters, like ``junit`` or ``json``, always require the ``--out`` option to be
4044
specified. The ``junit`` formatter generates ``*.xml`` files for every
41-
suite, so it needs a destination directory to put these XML files into.
45+
suite, so it needs a destination directory to put these XML files into. The ``json`` formatter
46+
outputs a single file, so it needs the path of this file (which will be created if it does
47+
not exist)
4248

4349
Also, you can specify multiple formats to be used by Behat using multiple --format options:
4450

@@ -130,6 +136,21 @@ The following options are specific to the Progress formatter:
130136
* ``shortSummary`` show just a list of failing scenarios at the end of the output. If false, a full summary
131137
(which also includes a list of failing steps) will be printed. Defaults to false
132138

139+
JUnit formatter
140+
^^^^^^^^^^^^^^^
141+
142+
The following options are specific to the JUnit formatter:
143+
144+
* ``timer`` show time spent in each scenario and feature. Boolean, defaults to true.
145+
146+
147+
JSON formatter
148+
^^^^^^^^^^^^^^
149+
150+
The following options are specific to the JSON formatter:
151+
152+
* ``timer`` show time spent in each scenario, feature and suite. Boolean, defaults to true.
153+
133154
Setting format options
134155
^^^^^^^^^^^^^^^^^^^^^^
135156

@@ -179,7 +200,7 @@ You can disable a formatter so that it won't be available by using the ``disable
179200
180201
return (new Config())->withProfile($profile);
181202
182-
203+
.. _`Schema`: https://github.com/Behat/Behat/blob/master/resources/schema.json
183204

184205

185206

0 commit comments

Comments
 (0)