Specflow


Configure Specflow for Freestyle

Prerequisites

1) MSBuild Plugin

2) VSTest Runnner Plugin

3) Visual Studio IDE setup or Visual Studio Build Tools setup on server


Step 1: Checkout Source Code.



Step 2: Add Script to update packages for msbuild using NuGet.exe file from checkout repository.



Step 3: Configure msbuild executable in Manage Jenkins > Global Tool Configuration > MSTest.




Step 4: Select a build step for MSBuild in Build Section.





Step 5: 1)Select "MSBuild Version" which is configured in Global Tool Configuration


     2)Specify the relative path for solution file in "MSBuild Build File"



Step 6: Configure vstest executable in Manage Jenkins > Global Tool Configuration > VSTest.


Step 7: Select a build step for VSTest in Build Section.



Step 8:   1)Select "VSTest Version" which is configured in Global Tool Configuration

2)Specify the relative path to your VSTest compiled assemblies in "Test Files"

3)Uncheck "Enable Code Coverage" checkbox




Configure Specflow for Pipeline


Prerequisites

1) VSTest Runnner Plugin

2) Visual Studio IDE setup or Visual Studio Build Tools setup on server


Step 1: Checkout Source Code.

checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/lizamathew/Spec-Flow-Demo.git']]])


Step 2: Add Script to update packages for msbuild using NuGet.exe file from checkout repository.

bat 'C:/Users/liza.mathew/.jenkins/workspace/PipelineSpecflowProjectMaster/Specflow/.nuget/NuGet.exe update -self'


Step 3: Configuration for MSBuild

bat "\"${tool 'MSBuild'}\" Specflow/SpecResults.sln"
(MSBuild is a tool configured for path to MSBuild executable then specify relative path for solution file of project)


Step 4: Configuration of VSTest

VSTest is a tool configured for path to VSTest executable.

step([$class: 'VsTestBuilder', 'vsTestName':'${tool VSTest}', enablecodecoverage : false, 'testFiles':'Specflow/SpecResults.ApprovalTestSuite/bin/Release/SpecResults.ApprovalTestSuite.dll'])


  • vsTestName: path to VSTest executable
  • testFiles: specify relative path to your VSTest compiled assemblies