Adding branch name to LivingDoc

Branch name in LivingDoc Generator

Using the --title command line option the branch name (and commit information) can be included in the generated HTML.

Branch Name

This process can be automated using a CI/CD system.

Branch name in Azure DevOps Pipeline

Azure DevOps Pipelines provides a rich set of variables like the branch name and commit message. Any of these variables can be used as part of the document title when the LivingDoc.CLI task is executed in the Pipeline.

First the LivingDoc.CLI has to be installed on the Agent, using the .NET Core build task

Install CLI

  • Command custom
  • Custom command: tool
  • Arguments: install --global SpecFlow.Plus.LivingDoc.CLI


- task: DotNetCoreCLI@2
  displayName: 'dotnet custom'
    command: custom
    custom: tool
    arguments: 'install --global SpecFlow.Plus.LivingDoc.CLI'

Then the CLI can be invoked after the Visual Studio Test task using the Command line task. In the script parameter the %Build_SourceBranchName% and %Build_SourceVersion% variables will be replaced during execution:

Invoke CLI


livingdoc test-assembly MyProject.Specs\bin\Debug\netcoreapp3.1\MyProject.Specs.dll --title "BookShop (%Build_SourceBranchName% - Build_SourceVersion:~0,7%)"


    - script: 'livingdoc test-assembly MyProject.Specs\bin\Debug\netcoreapp3.1\MyProject.Specs.dll --title "BookShop (%Build_SourceBranchName% - Build_SourceVersion:~0,7%)"'
      workingDirectory: BookShop.AcceptanceTests
      displayName: 'Command Line Script'