CSV Reports
Since v3.77.0
Gwen will generate CSV reports for you when you include results
in the format option.
By default, the following CSV files will be generated in the reports/results
subdirectory of your configured output
directory, but you can completely reconfigure this and create your own CSVs to suit your requirements:
- Feature level results:
feature-results-PASSED.csv
- A log of all passed feature resultsfeature-results-FAILED.csv
- A log of all failed feature results including the failed reasonfeature-results-ALL.csv
- A log of all feature results (passed or failed) including the failed reason (for failed)
- Scenario level results:
scenario-results-PASSED.csv
- A log of all passed scenario resultsscenario-results-FAILED.csv
- A log of all failed scenario results including the failed reasonscenario-results-ALL.csv
- A log of all scenario results (passed or failed) including the failed reason (for failed)
Configuration
Results files
CSV files can be configured within the gwen.reports.results.files
element in your settings file.
<fileId> {
file = "<filename>"
scope = "[scope]"
status = "[status]"
fields = [
{ name = "<fieldName 1>", ref = "[reference 1]", defaultValue = "[value 1]", excludes = "[excludeFields 1]"}
{ name = "<fieldName 2>", ref = "[reference 2]", defaultValue = "[value 2]", excludes = "[excludeFields 2]" }
..
{ name = "<fieldName N>", ref = "[reference N]", defaultValue = "[value N]", excludes = "[excludeFields N]" }
]
}
Where:
<fileId>
- (Mandatory) Is an arbitatry Id for the file element<filename>
- (Mandatory) - Is the name or path to the target CSV file- If a file name only is specified (without a prefixed path), then the named file will be written to the
reports/results
subdirectory within your configuredoutput
directory - If the file name is prefixed with a path, then the named file will be written to that location
- If a file name only is specified (without a prefixed path), then the named file will be written to the
[scope]
- (Optional) can be either:Feature
- To log the results of all features to the CSV file as they complete.- or
Feature: <name>
- To log the results of a specifically named Feature only, where<name>
is the name of the Feature to log the results for.
- or
Rule
- To log the results of all rules to the CSV file as they complete.- or
Rule: <name>
- To log the results of a specifically named Rule only, where<name>
is the name of the Rule to log the results for.
- or
Scenario
- To log the results of all scenarios to the CSV file as they complete.- or
Scenario: <name>
- To log the results of a specifically named Scenario only, where<name>
is the name of the Scenario to log the results for.
- or
Examples
- To log the results of all examples to the CSV file as they complete.- or
Examples: <name>
- To log the results of a specifically named Examples only, where<name>
is the name of the Examples to log the results for.
- or
StepDef
- To log the results of all StepDefs to the CSV file as they complete.- or
StepDef: <name>
- To log the results of a specifically named StepDef only, where<name>
is the name of the StepDef to log the results for.
- or
Note: Omit this
scope
attribute if you instead want to use the@Results
annotation or excplicit logging DSL to control where logging will occur.
[status]
- (Optional) can be either:Passed
- To log only passed results to the CSV fileFailed
- To log only failed results to the CSV file
fields
- (Mandatory) - Contains an array of fields as described below
Results fields
CSV fields are configured as arrays witihin the fields
attribute and have the following structure:
{ name = "<fieldName>", ref = "[reference]", defaultValue = "[value]", excludes = "[excludeFields]" }
Where:
<fieldName>
- (Mandatory) - Is the name of the field as it will appear in generated CSV[reference]
- (Optional) - Can be one of:- The name of a varaible in scope containing the value to bind
- If blank, will use the value bound to the variable of same name as
<fieldName>
If
<fieldName>
is set to*
, then:- This reference must specify a path to the CSV template file containing the names of all fields to bind in the first row (and the names of such fields will also be used as the binding references)
- Can also be set to the special reference
$<gwen.options.dataFile>
which will resolve to the input CSV (data feed) file passed to Gwen via the-i|--input-data <file>
launch option. In the case all the fields present in the input file will be included and resolved by name.
[value]
- (Optional) - Is a default value to use if the field binding is not in scope.- Omitting
defaultValue
altogether will make this field mandatory. Will result in an undefined binding error being raised at runtime if the field binding does does not exist (i.e: is not in scope) at the time the record is written.
- Omitting
[excludeFields]
- (Optional) - Comma separated list of fields to exclude when<fieldName>
is set to*
:- All fields in the template file (referred to by
[reference]
) that match those in the excludes list will be excluded
- All fields in the template file (referred to by
Default configuration
- conf
- json
- properties
- default
- redundant
In this configuration, fields are uniquely defined upfront and reused across file definitions.
gwen {
report {
results {
fields {
feature {
status = [
{ field = "EVAL_STATUS", ref = "gwen.feature.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.feature.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.feature.eval.finished" }
]
details = [
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
]
duration = [
{ field = "EVAL_DURATION", ref = "gwen.feature.eval.duration" }
]
message = [
{ field = "EVAL_MESSAGE", ref = "gwen.feature.eval.status.message" }
]
}
scenario {
status = [
{ field = "EVAL_STATUS", ref = "gwen.scenario.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.scenario.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.scenario.eval.finished" }
]
details = [
${gwen.report.results.fields.feature.details}
{ field = "SCENARIO_NAME", ref = "gwen.scenario.displayName" }
]
duration = [
{ field = "EVAL_DURATION", ref = "gwen.scenario.eval.duration" }
]
message = [
{ field = "EVAL_MESSAGE", ref = "gwen.scenario.eval.status.message" }
]
}
input {
data = [
{ field = "*", ref = "$<gwen.options.dataFile>" }
]
}
}
files {
feature {
passed {
file = "feature-results-PASSED.csv"
scope = "Feature"
status = "Passed"
fields = [
${gwen.report.results.fields.feature.status}
${gwen.report.results.fields.feature.details}
${gwen.report.results.fields.feature.duration}
${gwen.report.results.fields.input.data}
]
}
failed {
file = "feature-results-FAILED.csv"
scope = "Feature"
status = "Failed"
fields = [
${gwen.report.results.fields.feature.status}
${gwen.report.results.fields.feature.details}
${gwen.report.results.fields.feature.duration}
${gwen.report.results.fields.input.data}
${gwen.report.results.fields.feature.message}
]
}
all {
file = "feature-results-ALL.csv"
scope = "Feature"
fields = [
${gwen.report.results.fields.feature.status}
${gwen.report.results.fields.feature.details}
${gwen.report.results.fields.feature.duration}
${gwen.report.results.fields.input.data}
${gwen.report.results.fields.feature.message}
]
}
}
scenario {
passed {
file = "scenario-results-PASSED.csv"
scope = "Scenario"
status = "Passed"
fields = [
${gwen.report.results.fields.scenario.status}
${gwen.report.results.fields.scenario.details}
${gwen.report.results.fields.scenario.duration}
${gwen.report.results.fields.input.data}
]
}
failed {
file = "scenario-results-FAILED.csv"
scope = "Scenario"
status = "Failed"
fields = [
${gwen.report.results.fields.scenario.status}
${gwen.report.results.fields.scenario.details}
${gwen.report.results.fields.scenario.duration}
${gwen.report.results.fields.input.data}
${gwen.report.results.fields.scenario.message}
]
}
all {
file = "scenario-results-ALL.csv"
scope = "Scenario"
fields = [
${gwen.report.results.fields.scenario.status}
${gwen.report.results.fields.scenario.details}
${gwen.report.results.fields.scenario.duration}
${gwen.report.results.fields.input.data}
${gwen.report.results.fields.scenario.message}
]
}
}
}
}
}
}
In this configuration, fields are replicated across file definitions.
gwen {
report {
results {
files {
feature {
passed {
file = "feature-results-PASSED.csv"
scope = "Feature"
status = "Passed"
fields = [
{ field = "EVAL_STATUS", ref = "gwen.feature.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.feature.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.feature.eval.finished" }
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
{ field = "EVAL_DURATION", ref = "gwen.feature.eval.duration" }
{ field = "*", ref = "$<gwen.options.dataFile>" }
]
}
failed {
file = "feature-results-FAILED.csv"
scope = "Feature"
status = "Failed"
fields = [
{ field = "EVAL_STATUS", ref = "gwen.feature.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.feature.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.feature.eval.finished" }
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
{ field = "EVAL_DURATION", ref = "gwen.feature.eval.duration" }
{ field = "*", ref = "$<gwen.options.dataFile>" }
{ field = "EVAL_MESSAGE", ref = "gwen.feature.eval.status.message" }
]
}
all {
file = "feature-results-ALL.csv"
scope = "Feature"
fields = [
{ field = "EVAL_STATUS", ref = "gwen.feature.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.feature.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.feature.eval.finished" }
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
{ field = "EVAL_DURATION", ref = "gwen.feature.eval.duration" }
{ field = "*", ref = "$<gwen.options.dataFile>" }
{ field = "EVAL_MESSAGE", ref = "gwen.feature.eval.status.message" }
]
}
}
scenario {
passed {
file = "scenario-results-PASSED.csv"
scope = "Scenario"
status = "Passed"
fields = [
{ field = "EVAL_STATUS", ref = "gwen.scenario.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.scenario.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.scenario.eval.finished" }
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
{ field = "SCENARIO_NAME", ref = "gwen.scenario.displayName" }
{ field = "EVAL_DURATION", ref = "gwen.scenario.eval.duration" }
{ field = "*", ref = "$<gwen.options.dataFile>" }
]
}
failed {
file = "scenario-results-FAILED.csv"
scope = "Scenario"
status = "Failed"
fields = [
{ field = "EVAL_STATUS", ref = "gwen.scenario.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.scenario.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.scenario.eval.finished" }
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
{ field = "SCENARIO_NAME", ref = "gwen.scenario.displayName" }
{ field = "EVAL_DURATION", ref = "gwen.scenario.eval.duration" }
{ field = "*", ref = "$<gwen.options.dataFile>" }
{ field = "EVAL_MESSAGE", ref = "gwen.scenario.eval.status.message" }
]
}
all {
file = "scenario-results-ALL.csv"
scope = "Scenario"
fields = [
{ field = "EVAL_STATUS", ref = "gwen.scenario.eval.status.keyword.upperCased" }
{ field = "EVAL_STARTED", ref = "gwen.scenario.eval.started" }
{ field = "EVAL_FINISHED", ref = "gwen.scenario.eval.finished" }
{ field = "FEATURE_FILE", ref = "gwen.feature.file.path" }
{ field = "FEATURE_NAME", ref = "gwen.feature.displayName" }
{ field = "SCENARIO_NAME", ref = "gwen.scenario.displayName" }
{ field = "EVAL_DURATION", ref = "gwen.scenario.eval.duration" }
{ field = "*", ref = "$<gwen.options.dataFile>" }
{ field = "EVAL_MESSAGE", ref = "gwen.scenario.eval.status.message" }
]
}
}
}
}
}
}
In this configuration, fields are replicated across file definitions (note: field reuse is only supported in conf
format and not json
).
{
"gwen": {
"report": {
"results": {
"files": {
"feature": {
"passed": {
"file": "feature-results-PASSED.csv",
"scope": "Feature",
"status": "Passed",
"fields": [
{ "field": "EVAL_STATUS", "ref": "gwen.feature.eval.status.keyword.upperCased" },
{ "field": "EVAL_STARTED", "ref": "gwen.feature.eval.started" },
{ "field": "EVAL_FINISHED", "ref": "gwen.feature.eval.finished" },
{ "field": "FEATURE_FILE", "ref": "gwen.feature.file.path" },
{ "field": "FEATURE_NAME", "ref": "gwen.feature.displayName" },
{ "field": "EVAL_DURATION", "ref": "gwen.feature.eval.duration" },
{ "field": "*", "ref": "$<gwen.options.dataFile>" }
]
},
"failed": {
"file": "feature-results-FAILED.csv",
"scope": "Feature",
"status": "Failed",
"fields": [
{ "field": "EVAL_STATUS", "ref": "gwen.feature.eval.status.keyword.upperCased" },
{ "field": "EVAL_STARTED", "ref": "gwen.feature.eval.started" },
{ "field": "EVAL_FINISHED", "ref": "gwen.feature.eval.finished" },
{ "field": "FEATURE_FILE", "ref": "gwen.feature.file.path" },
{ "field": "FEATURE_NAME", "ref": "gwen.feature.displayName" },
{ "field": "EVAL_DURATION", "ref": "gwen.feature.eval.duration" },
{ "field": "*", "ref": "$<gwen.options.dataFile>" },
{ "field": "EVAL_MESSAGE", "ref": "gwen.feature.eval.status.message" }
]
},
"all": {
"file": "feature-results-ALL.csv",
"scope": "Feature",
"fields": [
{ "field": "EVAL_STATUS", "ref": "gwen.feature.eval.status.keyword.upperCased" },
{ "field": "EVAL_STARTED", "ref": "gwen.feature.eval.started" },
{ "field": "EVAL_FINISHED", "ref": "gwen.feature.eval.finished" },
{ "field": "FEATURE_FILE", "ref": "gwen.feature.file.path" },
{ "field": "FEATURE_NAME", "ref": "gwen.feature.displayName" },
{ "field": "EVAL_DURATION", "ref": "gwen.feature.eval.duration" },
{ "field": "*", "ref": "$<gwen.options.dataFile>" },
{ "field": "EVAL_MESSAGE", "ref": "gwen.feature.eval.status.message" }
]
}
},
"scenario": {
"passed": {
"file": "scenario-results-PASSED.csv",
"scope": "Scenario",
"status": "Passed",
"fields": [
{ "field": "EVAL_STATUS", "ref": "gwen.scenario.eval.status.keyword.upperCased" },
{ "field": "EVAL_STARTED", "ref": "gwen.scenario.eval.started" },
{ "field": "EVAL_FINISHED", "ref": "gwen.scenario.eval.finished" },
{ "field": "FEATURE_FILE", "ref": "gwen.feature.file.path" },
{ "field": "FEATURE_NAME", "ref": "gwen.feature.displayName" },
{ "field": "SCENARIO_NAME", "ref": "gwen.scenario.displayName" },
{ "field": "EVAL_DURATION", "ref": "gwen.scenario.eval.duration" },
{ "field": "*", "ref": "$<gwen.options.dataFile>" }
]
},
"failed": {
"file": "scenario-results-FAILED.csv",
"scope": "Scenario",
"status": "Failed",
"fields": [
{ "field": "EVAL_STATUS", "ref": "gwen.scenario.eval.status.keyword.upperCased" },
{ "field": "EVAL_STARTED", "ref": "gwen.scenario.eval.started" },
{ "field": "EVAL_FINISHED", "ref": "gwen.scenario.eval.finished" },
{ "field": "FEATURE_FILE", "ref": "gwen.feature.file.path" },
{ "field": "FEATURE_NAME", "ref": "gwen.feature.displayName" },
{ "field": "SCENARIO_NAME", "ref": "gwen.scenario.displayName" },
{ "field": "EVAL_DURATION", "ref": "gwen.scenario.eval.duration" },
{ "field": "*", "ref": "$<gwen.options.dataFile>" },
{ "field": "EVAL_MESSAGE", "ref": "gwen.scenario.eval.status.message" }
]
},
"all": {
"file": "scenario-results-ALL.csv",
"scope": "Scenario",
"fields": [
{ "field": "EVAL_STATUS", "ref": "gwen.scenario.eval.status.keyword.upperCased" },
{ "field": "EVAL_STARTED", "ref": "gwen.scenario.eval.started" },
{ "field": "EVAL_FINISHED", "ref": "gwen.scenario.eval.finished" },
{ "field": "FEATURE_FILE", "ref": "gwen.feature.file.path" },
{ "field": "FEATURE_NAME", "ref": "gwen.feature.displayName" },
{ "field": "SCENARIO_NAME", "ref": "gwen.scenario.displayName" },
{ "field": "EVAL_DURATION", "ref": "gwen.scenario.eval.duration" },
{ "field": "*", "ref": "$<gwen.options.dataFile>" },
{ "field": "EVAL_MESSAGE", "ref": "gwen.scenario.eval.status.message" }
]
}
}
}
}
}
}
}
In this configuration, fields are replicated across file definitions (note: field reuse is only supported in conf
format and not properties
).
gwen.report.results.files.feature.passed.file = feature-results-PASSED.csv
gwen.report.results.files.feature.passed.scope = Feature
gwen.report.results.files.feature.passed.status = Passed
gwen.report.results.files.feature.passed.fields.01.field = EVAL_STATUS
gwen.report.results.files.feature.passed.fields.01.ref = gwen.feature.eval.status.keyword.upperCased
gwen.report.results.files.feature.passed.fields.02.field = EVAL_STARTED
gwen.report.results.files.feature.passed.fields.02.ref = gwen.feature.eval.started
gwen.report.results.files.feature.passed.fields.03.field = EVAL_FINISHED
gwen.report.results.files.feature.passed.fields.03.ref = gwen.feature.eval.finished
gwen.report.results.files.feature.passed.fields.04.field = FEATURE_FILE
gwen.report.results.files.feature.passed.fields.04.ref = gwen.feature.file.path
gwen.report.results.files.feature.passed.fields.05.field = FEATURE_NAME
gwen.report.results.files.feature.passed.fields.05.ref = gwen.feature.displayName
gwen.report.results.files.feature.passed.fields.06.field = EVAL_DURATION
gwen.report.results.files.feature.passed.fields.06.ref = gwen.feature.eval.duration
gwen.report.results.files.feature.passed.fields.07.field = *
gwen.report.results.files.feature.passed.fields.07.ref = $<gwen.options.dataFile>
gwen.report.results.files.feature.failed.file = feature-results-FAILED.csv
gwen.report.results.files.feature.failed.scope = Feature
gwen.report.results.files.feature.failed.status = Failed
gwen.report.results.files.feature.failed.fields.01.field = EVAL_STATUS
gwen.report.results.files.feature.failed.fields.01.ref = gwen.feature.eval.status.keyword.upperCased
gwen.report.results.files.feature.failed.fields.02.field = EVAL_STARTED
gwen.report.results.files.feature.failed.fields.02.ref = gwen.feature.eval.started
gwen.report.results.files.feature.failed.fields.03.field = EVAL_FINISHED
gwen.report.results.files.feature.failed.fields.03.ref = gwen.feature.eval.finished
gwen.report.results.files.feature.failed.fields.04.field = FEATURE_FILE
gwen.report.results.files.feature.failed.fields.04.ref = gwen.feature.file.path
gwen.report.results.files.feature.failed.fields.05.field = FEATURE_NAME
gwen.report.results.files.feature.failed.fields.05.ref = gwen.feature.displayName
gwen.report.results.files.feature.failed.fields.06.field = EVAL_DURATION
gwen.report.results.files.feature.failed.fields.06.ref = gwen.feature.eval.duration
gwen.report.results.files.feature.failed.fields.07.field = *
gwen.report.results.files.feature.failed.fields.07.ref = $<gwen.options.dataFile>
gwen.report.results.files.feature.failed.fields.08.field = EVAL_MESSAGE
gwen.report.results.files.feature.failed.fields.08.ref = gwen.feature.eval.status.message
gwen.report.results.files.feature.all.file = feature-results-ALL.csv
gwen.report.results.files.feature.all.scope = Feature
gwen.report.results.files.feature.all.fields.01.field = EVAL_STATUS
gwen.report.results.files.feature.all.fields.01.ref = gwen.feature.eval.status.keyword.upperCased
gwen.report.results.files.feature.all.fields.02.field = EVAL_STARTED
gwen.report.results.files.feature.all.fields.02.ref = gwen.feature.eval.started
gwen.report.results.files.feature.all.fields.03.field = EVAL_FINISHED
gwen.report.results.files.feature.all.fields.03.ref = gwen.feature.eval.finished
gwen.report.results.files.feature.all.fields.04.field = FEATURE_FILE
gwen.report.results.files.feature.all.fields.04.ref = gwen.feature.file.path
gwen.report.results.files.feature.all.fields.05.field = FEATURE_NAME
gwen.report.results.files.feature.all.fields.05.ref = gwen.feature.displayName
gwen.report.results.files.feature.all.fields.06.field = EVAL_DURATION
gwen.report.results.files.feature.all.fields.06.ref = gwen.feature.eval.duration
gwen.report.results.files.feature.all.fields.07.field = *
gwen.report.results.files.feature.all.fields.07.ref = $<gwen.options.dataFile>
gwen.report.results.files.feature.all.fields.08.field = EVAL_MESSAGE
gwen.report.results.files.feature.all.fields.08.ref = gwen.feature.eval.status.message
gwen.report.results.files.scenario.passed.file = scenario-results-PASSED.csv
gwen.report.results.files.scenario.passed.scope = Scenario
gwen.report.results.files.scenario.passed.status = Passed
gwen.report.results.files.scenario.passed.fields.01.field = EVAL_STATUS
gwen.report.results.files.scenario.passed.fields.01.ref = gwen.scenario.eval.status.keyword.upperCased
gwen.report.results.files.scenario.passed.fields.02.field = EVAL_STARTED
gwen.report.results.files.scenario.passed.fields.02.ref = gwen.scenario.eval.started
gwen.report.results.files.scenario.passed.fields.03.field = EVAL_FINISHED
gwen.report.results.files.scenario.passed.fields.03.ref = gwen.scenario.eval.finished
gwen.report.results.files.scenario.passed.fields.04.field = FEATURE_FILE
gwen.report.results.files.scenario.passed.fields.04.ref = gwen.feature.file.path
gwen.report.results.files.scenario.passed.fields.05.field = FEATURE_NAME
gwen.report.results.files.scenario.passed.fields.05.ref = gwen.feature.displayName
gwen.report.results.files.scenario.passed.fields.06.field = SCENARIO_NAME
gwen.report.results.files.scenario.passed.fields.06.ref = gwen.scenario.displayName
gwen.report.results.files.scenario.passed.fields.07.field = EVAL_DURATION
gwen.report.results.files.scenario.passed.fields.07.ref = gwen.scenario.eval.duration
gwen.report.results.files.scenario.passed.fields.08.field = *
gwen.report.results.files.scenario.passed.fields.08.ref = $<gwen.options.dataFile>
gwen.report.results.files.scenario.failed.file = scenario-results-FAILED.csv
gwen.report.results.files.scenario.failed.scope = Scenario
gwen.report.results.files.scenario.failed.status = Failed
gwen.report.results.files.scenario.failed.fields.01.field = EVAL_STATUS
gwen.report.results.files.scenario.failed.fields.01.ref = gwen.scenario.eval.status.keyword.upperCased
gwen.report.results.files.scenario.failed.fields.02.field = EVAL_STARTED
gwen.report.results.files.scenario.failed.fields.02.ref = gwen.scenario.eval.started
gwen.report.results.files.scenario.failed.fields.03.field = EVAL_FINISHED
gwen.report.results.files.scenario.failed.fields.03.ref = gwen.scenario.eval.finished
gwen.report.results.files.scenario.failed.fields.04.field = FEATURE_FILE
gwen.report.results.files.scenario.failed.fields.04.ref = gwen.feature.file.path
gwen.report.results.files.scenario.failed.fields.05.field = FEATURE_NAME
gwen.report.results.files.scenario.failed.fields.05.ref = gwen.feature.displayName
gwen.report.results.files.scenario.failed.fields.06.field = SCENARIO_NAME
gwen.report.results.files.scenario.failed.fields.06.ref = gwen.scenario.displayName
gwen.report.results.files.scenario.failed.fields.07.field = EVAL_DURATION
gwen.report.results.files.scenario.failed.fields.07.ref = gwen.scenario.eval.duration
gwen.report.results.files.scenario.failed.fields.08.field = *
gwen.report.results.files.scenario.failed.fields.08.ref = $<gwen.options.dataFile>
gwen.report.results.files.scenario.failed.fields.09.field = EVAL_MESSAGE
gwen.report.results.files.scenario.failed.fields.09.ref = gwen.scenario.eval.status.message
gwen.report.results.files.scenario.all.file = scenario-results-ALL.csv
gwen.report.results.files.scenario.all.scope = Scenario
gwen.report.results.files.scenario.all.fields.01.field = EVAL_STATUS
gwen.report.results.files.scenario.all.fields.01.ref = gwen.scenario.eval.status.keyword.upperCased
gwen.report.results.files.scenario.all.fields.02.field = EVAL_STARTED
gwen.report.results.files.scenario.all.fields.02.ref = gwen.scenario.eval.started
gwen.report.results.files.scenario.all.fields.03.field = EVAL_FINISHED
gwen.report.results.files.scenario.all.fields.03.ref = gwen.scenario.eval.finished
gwen.report.results.files.scenario.all.fields.04.field = FEATURE_FILE
gwen.report.results.files.scenario.all.fields.04.ref = gwen.feature.file.path
gwen.report.results.files.scenario.all.fields.05.field = FEATURE_NAME
gwen.report.results.files.scenario.all.fields.05.ref = gwen.feature.displayName
gwen.report.results.files.scenario.all.fields.06.field = SCENARIO_NAME
gwen.report.results.files.scenario.all.fields.06.ref = gwen.scenario.displayName
gwen.report.results.files.scenario.all.fields.07.field = EVAL_DURATION
gwen.report.results.files.scenario.all.fields.07.ref = gwen.scenario.eval.duration
gwen.report.results.files.scenario.all.fields.08.field = *
gwen.report.results.files.scenario.all.fields.08.ref = $<gwen.options.dataFile>
gwen.report.results.files.scenario.all.fields.09.field = EVAL_MESSAGE
gwen.report.results.files.scenario.all.fields.09.ref = gwen.scenario.eval.status.message
Results Annotation
Used to log results to a file at a specific Feature, Rule, Scenario, StepDef, Scenaro Outline, or Examples node level.
Syntax:
For single file
@Results('<fileId>')
For multiple files (since v4.0.0)
@Results(['<fileId1>','<fileId2>','<fileIdN>'])
Where:
<fileId>
- Is a configured file Id under thegwen.reports.results.files
settings element.
Example:
The configuration for my.csv
might be defiend as follows in your settings file. Note that the scope
attribute is deliberately absent here, since we will using the Results
annotation to specify where the scope will be.
gwen {
..
reports {
results {
files {
my {
csv {
file = "file.csv"
fields = [
{ field = "status", ref = "gwen.scenario.eval.status.keyword.upperCased" }
{ field = "name", ref = "my name" }
{ field = "job", ref = "my job" }
{ field = "duration", ref = "gwen.scenario.eval.duration" }
]
}
}
}
}
}
..
}
Specifying the @Results('my.csv')
annotation on a scenario, would then log to results to the configured file when the scenario completes.
The scope of the my.csv
file would then be bound to this Scenario.
Feature: My feature
@Results('my.csv')
Scenario: My scenario
Given my name is "Gwen"
And my job is "Automation"
..
And the generated results file would then contain:
file.csvstatus,name,job,duration
PASSED,Gwen,Automation,1ms
When used on a Scenario Outline, each Examples scenario would be logged.
my.featureFeature: My feature
@Results('my.csv')
Scenario Outline: My scenario
Given my name is <name>
And my job is <job>
Examples:
| name | job |
| Gwen | Automation |
| Stacey | Agent |
..
The generated results file would then contain:
file.csvstatus,name,job,duration
PASSED,Gwen,Automation,1ms
PASSED,Gwen,Automation,2ms
..
The @Results
annotation can also be used on Scenario Outlies in conjunction with the @Examples annotation for the same effect.
Feature: My meta
@Examples('data-records.csv`)
@Results('my.csv')
Scenario Outline: My scenario
Given my name is <name>
And my job is <job>
..
Logging Results
With the above settings in place, CSV files containing evaluated results will automatiacally be logged when you launch Gwen to execute with the -f results
format option.
- Yarn
- npm
- pnpm
Executing features in the gwen/features/todo
folder and log CSV reports.
To generate CSV files only
yarn gwen -b -f results gwen/features/todo
To generate HTML reports and CSV files
yarn -b f html,results gwen/features/todo
Executing features in the gwen/features/todo
folder and log CSV reports.
To generate CSV files only
npm run gwen -- -b -f results gwen/features/todo
To generate HTML reports and CSV files
npm run gwen -- -b f html,results gwen/features/todo
Executing features in the gwen/features/todo
folder and log CSV reports.
To generate CSV files only
pnpm gwen -b -f results gwen/features/todo
To generate HTML reports and CSV files
pnpm -b f html,results gwen/features/todo
- The CSV results logged to:
output/reports/results/
- The HTML report will be generated at
output/reports/index.html
.
Explicit logging
The following DSL is also avaialble for cases where you might want to log records explicity (without automatic scoped logging).