How to set number of test run(s) on TFS 2010 build? - msbuild

Is it possible to set number of test runs variable on TFS 2010 build so that is displayed in the build summary? We are running NUnit tests and can get the number of tests run. At the moment we see "No Test Results" in build summary.

and congratulations on your promotion from shoe-salesman to TFS technician... :)
You can add the NUnit test run results to the TFS build report in one of two ways:
1. You can write a simple XSLT to transform the nunit report to a TRX file (which TFS can read).
2. You can use NUnit for Team Build.
Either way, the NUnit results will be added to the report, including the count of successful, failed, inconclusive and (IIRC) total count of tests.
Hope this helps,
Assaf.

Related

Control Build Result in TFS2015

I'm using TFS2015 build definitions. Basically, I have a definition with a Visual Studio Build task and then a Visual Studio Test task. In this set up, if the Build task succeeds, but the Test task fails, the entire build fails. Is there a way to get this to set the result to "partiallySucceeded?"
The reason I want to do this is for our CodedUI tests. I want to be able to test a "partiallySucceeded" build using Release Management, but currently all of our builds are either "succeeded" or "failed," even though some of the "failed" ones are only due to 1 or 2 unit tests.
Make sure you set the "continue in error" checkbox on the test task.

How to customize code coverage summary in TFS 2015

We are using TFS 2015 vNext Build to manage our CI build.
It is quite easy to enable the test coverage in the visual studio test task.
But in the build summary, it only give a overall block overage percentage.
For each assembly, the summary only indicate the covered block and line.
For example:
It is quite time consuming to download and open the .coverage file to get the detail block covered percentage for each assembly when assembly count is huge.
Is there any way that we can configure the summary to show the block covered percentage for each assembly?
Currently, these customizations are not supported. You can't edit the displays in vNext build result summary.
You can submit a feature request to User Voice site at:
https://visualstudio.uservoice.com/forums/330519-team-services The TFS
Administrator and PM will kindly review the suggestion.

Units Tests Coverage is not updated after analysis - MSBuild.SonarQube.Runner-1.0.2

After I did an analysis of my .Net/C# project using MSBuild.SonarQube.Runner-1.0.2, I'm able to get all the values in my SonarQube Dashboard except for the Unit Tests Coverage, which is still being shown as 0.0%.
Here's the environment I'm using...
Visual Studio 2015
MSTest
MSBuild.SonarQube.Runner-1.0.2
The following commands were executed from Developer Command Prompt for VS2015
path=%path%;C:\SonarQube\MSBuild.SonarQube.Runner-1.0.2
MSBuild.SonarQube.Runner begin /k:tp /n:TestProject /v:1.0 /d:sonar.cs.vscoveragexml.reportsPaths="C:\SonarQube\Temp\VisualStudio.coverage.xml"
Msbuild
"%VSINSTALLDIR%\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" collect /output:"C:\SonarQube\Temp\VisualStudio.coverage" "%VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\Projects\TestProject\TestProject.Test\bin\Debug\TetProject.Test.dll"
"%VSINSTALLDIR%\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:"C:\SonarQube\Temp\VisualStudio.coverage.xml" "C:\SonarQube\Temp\VisualStudio.coverage"
MSBuild.SonarQube.Runner end
I would appreciate any help in resolving this.

Don't Run Unit Tests from Certain Assemblies in TFS 2012 Build Definition

In TFS 2012, we have several build definitions - CIs, Deployments and nightly.
Our CI builds run all of the (n)unit tests from our solution, however, we need to get it to ignore certain tests.
This is because we have some long running integration tests, and these only need to be run nightly.
Things I've tried:
Using the TestCategoryAttribute (from MSTest) and setting the Test Case Filter property try and exclude 'Integration'.
Using the CategoryAttribute (from NUnit) and setting the Test Case Filter property try and exclude 'Integration'.
A combination of the above.
The tests that need to be ignored are all in separate assemblies with the word IntegrationTests or Integration.Tests in the name.
Thanks,
Kieron
I've been using a combination of the MSTest TestCategory attribute on my unit tests, and the Test category filter setting for my build process definition in TFS 2012.
According to the Microsoft MSDN article found here you can specify which categories to use by setting the Test category filter to
TestCategory=CategoryName
According to your original post, you'd need to use the following filter:
TestCategory!=Integration
and decorate your tests with this attribute:
[TestCategory("Integration")]
Do this on all of your unit tests that you want ignored during your build. The test lists have been deprecated in Visual Studio, and it took a while to convert everything to the categories, but in the end it's worth it.
Hope that helps!

No link to the test results in the Build Results reports in TFS 2008

Is there a way to display the test results on the build results page returned by Build.aspx page? Because right now you only get to see the total number of tests and the number of failed and passed tests as in the sample:
Result details for Any CPU/Debug 0 errors, 90 warnings, 12 tests total, 4 tests passed, 8 tests failed
Errors and Warnings: 0 errors, 90 warnings
Test Results: 1 test runs completed, 12 tests total, 4 passed, 8 failed
Test Run Run By Total Passed Failed
TFSBUILD#TFB 2008-01-15 15:23:42_Any CPU_Debug PROJECTA\TFSBUILD 12 4 8
Furthermore in the Visual Studio 2008 GUI the Test Run can be opened because it is a link point to the .trx file in the TestResults subfolder of the \Build\ folder but the Build.aspx page does not show this as a link. Better would be maybe if you would get to see the list of tests and for each whether it passed or not.
I am saying this because we use the Team Foundation Build Notification Tool from the TFS 2008 Power Tools and right now you see that a build failed or partially succeeded but you cannot see the test list.
It's been one of my constant frustrations with VSTS that, out of the box, test results are not visible to anyone who does not have the VS Test SKU. See this question on how to at least get .trx files into HTML.
As for the build summary itself, last I heard there is no way to customize this, nor are there plans to allow doing so in the future. One could do the transformation of the .trx test results file, and post the HTML results to a known location, though.