JSON Reports
Gwen can generete JSON reports enabling you to feed evaulation results into other Gherkin report formatters or your own custom one.
Generate reports
Launch Gwen with the -f json
option to generate JSON reports when executing your features.
- Yarn
- npm
- pnpm
Execute features in the gwen/features/todo folder and generate JSON reports only.
yarn gwen -b -f json gwen/features/todo
Execute features in the gwen/features/todo folder and generate HTML and JSON reports.
yarn gwen -b -f html,json gwen/features/todo
Execute features in the gwen/features/todo folder and generate JSON reports only.
npm run gwen -- -b -f json gwen/features/todo
Execute features in the gwen/features/todo folder and generate HTML and JSON reports.
npm run gwen -- -b -f html,json gwen/features/todo
Execute features in the gwen/features/todo folder and generate JSON reports only.
pnpm gwen -b -f json gwen/features/todo
Execute features in the gwen/features/todo folder and generate HTML and JSON reports.
pnpm gwen -b -f html,json gwen/features/todo
Output
- Reports will be generated in the
gwen/output/reports
directory as per the defaultgwen.launch.options.report
setting- The JSON report files will be generated at
gwen/output/reports/json/*.json
. - The HTML report will be generated at
gwen/output/reports/index.html
. - If you want reports generated in a different directory, you can either:
- Amend the above setting to change the default
- Or include the
-r|--report
CLI option and specify a directory on every launch
- The JSON report files will be generated at
Sample output
File: json/features-todo-Todo.feature.json
[
{
"uri": "features\/todo\/Todo.feature",
"keyword": "Feature",
"id": "features-todo-Todo.feature;add-todo-items",
"line": 3,
"name": "features\/todo\/Todo.feature: Add todo items",
"description": "",
"tags": [
{
"name": "@Sample",
"line": 2,
}
],
"elements": [
{
"keyword": "Scenario",
"id": "scenario;create-todo-list;1",
"line": 5,
"name": "Create todo list",
"description": "",
"type": "scenario",
"steps": [
{
"keyword": "Given ",
"name": "a new todo list",
"line": 6,
"match": {
"location": "features\/todo\/Todo.meta:6"
},
"result": {
"status": "passed",
"duration": 6151153459
}
},
{
"keyword": "When ",
"name": "the following items are added",
"line": 7,
"rows": [
{
"cells": [
"Item"
],
"line": 8,
"id": "scenario;create-todo-list;1;1;8"
},
{
"cells": [
"Get the milk"
],
"line": 9,
"id": "scenario;create-todo-list;1;2;9"
},
{
"cells": [
"Walk the dog"
],
"line": 10,
"id": "scenario;create-todo-list;1;3;10"
}
],
"result": {
"status": "passed",
"duration": 18004904227
}
},
{
"keyword": "Then ",
"name": "the list will contain 2 items",
"line": 11,
"match": {
"location": "features\/todo\/Todo.meta:24"
},
"result": {
"status": "passed",
"duration": 201269901
}
}
]
}
]
}
]