LivingDoc Plugin Setup

If you want to generate LicingDoc with test results you must install this plugin, otherwise, you may skip this step to generate LivingDoc without test results.

Installation

Add the SpecFlow.Plus.LivingDocPlugin NuGet package to your SpecFlow project.

Configuration

LivingDoc Generator configuration options have a default setting. Simple SpecFlow projects may not require any further configuration.

livingDocGenerator

Use this section to extend your specflow.json with LivingDoc Generator configuration.

Attribute Value Description
enabled true/false Determines whether SpecFlow should generate the json file.
Default: true
filePath absolute /relative path The path of the generated json. Can be an absolute path or a relative path to the TestAssembly.
Default: TestExecution.json (in the same folder as the TestAssembly).

Placeholder support in filePath

The following placeholders are supported inside the filePath:

  • {CurrentDirectory} the current working directory. Note: Add this placeholder if the TestExecution.json file is not generated to the output directory. This is required in case of xUnit targeting full framework.
  • {ProcessId} the Id of the current process
  • {ThreadId} the Id of the current thread
  • {Now} the timestamp with the current date and time. The default format is yyyyMMddhhmmss, but it can be overwritten with format strings. e.g: {Now:yyyy-MM-dd} For an overview of the available format strings, see Standard Date and Time Format Strings and Custom Date and Time Format Strings in the official Microsoft documentation.

These placeholders can be used to make the generated file name unique when the tests are running in parallel and the test runner supports process level isolation like the SpecFlow+Runner. All placeholders are case insensitive, so they can be used with different casing. e.g: {ThreadId} or {threadid}.

Examples

simple specflow.json example:

{
  "livingDocGenerator": {
    "enabled": true,
    "filePath": "TestExecution.json"
  }
}

specflow.json example with CurrentDirectory placeholder:

{
  "livingDocGenerator": {
    "enabled": true,
    "filePath": "{CurrentDirectory}\\TestExecution.json"
  }
}

specflow.json example for SpecFlow+Runner using Process isolation:

{
  "livingDocGenerator": {
    "enabled": true,
    "filePath": "TestExecution_{ProcessId}_{ThreadId}_{Now}.json"
  }
}