In Bamboo portal, I have created different tasks in which I checkout the code and fetch latest code, build the solution using MSBuild, run the Sonarqube analysis using Scripts.
The scripts also contains the scripts for running the testcases.This is how it looks.
Task1 : Source code checkout configuration : I have selected the repository name.
Task2 : Command Configuration : This steps restores the Nuget packages into the solution
Task3 : Script Configuration : Start Sonar Scanner Script used is :
<span>"C:\sonar-scanner-msbuild-net461\MSBuild.SonarQube.Runner.exe"</span><span> begin </span><span>/</span><span>k</span><span>:</span><span>"ProjectKey"</span> <span>/</span><span>n</span><span>:</span><span>"ProjectName"</span> <span>/</span><span>v</span><span>:</span><span>"1"</span> <span>/</span><span>d</span><span>:</span><span>sonar</span><span>.</span><span>host</span><span>.</span><span>url</span><span>=</span><span>"SonarqubeURL"</span> <span>/</span><span>d</span><span>:</span><span>sonar</span><span>.</span><span>login</span><span>=</span><span>435454352345fgdfdsfvdc342434</span> <span>/</span><span>d</span><span>:</span><span>sonar</span><span>.</span><span>cs</span><span>.</span><span>vscoveragexml</span><span>.</span><span>reportsPaths</span><span>=</span><span>"C:\Project\Application.coveragexml"</span>
Task4 : Command Configuration : MSBuild : Builds the solution
Task5 : Script Configuration : Run unit Tests: Scripts used : One will run the test cases and generates a binary file, another one will convert binary to XML coverage file
<span>"C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe"</span><span> collect </span><span>/</span><span>output</span><span>:</span><span>"C:\Project\Application.coverage"</span> <span>"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"</span> <span>"TestProject\bin\Release\TestProject.dll"</span>
<span>"C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe"</span><span> analyze </span><span>/</span><span>output</span><span>:</span><span>"C:\Project\Application.coveragexml"</span> <span>"C:\Project\Application.coverage"</span>
Task6 : Script Configuration : End Sonar Scanner
<span>"C:\sonar-scanner-msbuild-net461\MSBuild.SonarQube.Runner.exe"</span><span> end </span><span>/</span><span>d</span><span>:</span><span>sonar</span><span>.</span><span>login</span><span>=</span><span>435454352345fgdfdsfvdc342434</span>
These are the tasks in my stage in Bamboo. Task6 publishes the results of testcases to Sonarqube dashboard. Now this is all happening as expected.
But when I run this plan, it shows it is a testless build. Task5 is running all the testcases, but how to make Bamboo know that the test cases are running. Also , if any of the unit testcases are failing, how to show the no of test cases successful and failed ,like test cases passed :X , failed :Y.
Is there any additional step am I missing? Any help is much appreciated.
PS : This is a windows service in c# and used MStest for writing testcases.