Include the name of the current branch in the Generated HTML

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

../_images/branch-name.pngBranch Name

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

Include the branch name using the 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

../_images/azdo-pipeline-install-cli.pngInstall 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:

../_images/azdo-pipeline-invoke-cli.pngInvoke CLI


livingdoc TestProjectDirectory\bin\Debug\netcoreapp3.1\FeatureData.json --title "BookShop (%Build_SourceBranchName% - Build_SourceVersion:~0,7%)"


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