PowerShell Execution Script - jole78/TeamCity.SpecFlow.Reporting GitHub Wiki

Introduction

Sometimes I can find it handy to actually use the tsr script locally and then include it as part of the source code. This example simply shows an example of such a script and how you can use it (as an alternative to inline source code)


images/psrunner-alternative-001.png

First, I'll add a new PS file to my specflow project, Execute-Tests.ps1. Here's an example of what it might look like:

Set-Location $PSScriptRoot

Import-Module .\TeamCity.SpecFlow.Reporting.psm1

Set-Properties @{
    PathToPackagesFolder = '..\..\'
}

Invoke-TeamCitySpecFlowReport

Finally inside the TeamCity PowerShell runner I'll make these changes:

images/psrunner-alternative-002.png

Things to notice:

  • Working Directory is set by the script (you can do that with inline also if you like it better)
  • I'm executing a file now instead of source code so change a couple of things to accomodate that.

That's it!