DotCover in TeamCity 8 doesn't work - c#

I try to run dotCover with my NUnit tests, in the TeamCity 8 as a build step. But no metter what I try I always get the same error in the log file:
Step 4/4: Coverage (NUnit) (1s)
[Step 4/4] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[Step 4/4] in directory: C:\TeamCity\buildAgent\work\6aee0f0d2626793d
[Step 4/4] ##teamcity[importData type='dotNetCoverage' tool='dotcover' file='C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover3226256377023598081.data']
[Step 4/4] Importing data from 'C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover3226256377023598081.data' with 'dotNetCoverage' processor
[Step 4/4] Rejected coverage report file: C:\TeamCity\buildAgent\temp\buildTmp\coverage_dotcover3226256377023598081.data size: 0. File is empty or does not exist
[Step 4/4] Process exited with code -2146232576
[Step 4/4] Step Coverage (NUnit) failed
I have tried to use both the included in TeamCity dotCover and the separately installed one, but both are failing with the same error.
My configuration:
If I choose no coverage tool, the tests work fine on its own. But with dotCover selected I always get the same error.
Any help here would be much appreciated.

Check out: http://confluence.jetbrains.com/pages/viewpage.action?pageId=49448495
In the case of internal TeamCity DotCover, you have to add the "ALL APPLICATION PACKAGES" read access rights to the TeamCity installation folder. If using an external DotCover, add the rights there.
This corrected the issue for me, for now.

It's probably because you are running this on build agent without .NET 3.5 (but with 4.0). It's easy to check because you will get exception just after running dotCover.exe on this agent. Install .NET 3.5 (using Server Manager in case of newest Windows).
The next thing is that there is another bug with dotCover in TeamCity 8. You need to use trial dotCover installation until they fix it (and put the path to installed dotCover into the build step configuration).
It solved the problem in my case.

Interestingly, for me at least, it worked for me once I disabled code coverage (i.e. un-selected an item in the .NET Coverage tool drop-down) and ran the build. When I re-enabled code coverage it worked (with no other changes to anything in TeamCity or on the build server). Weird!
I'm currently running TeamCity version 8.0.4 (build 27616).

This is similar to my issue, where the NUnit fails to run when dotCover is enabled.
I resolved this by setting .NET Runtime: Platform: as x86 in the configuration dropdown and I think the error is due to team city fails to figure out which is the correct platform.

Related

Why does the NUnit Test Adapter give me FileNotFound Exception while converting features?

I'm using VisualStudio 2015. I have installed the NUnit3 (3.5), NUnit3TestAdapter (3.6 also installed the VS extention), SpecFlow (2.1.0) and corresponding Selenium drivers NuGet packages.
I have one solution with two projects in them. One projects builds perfectly and discovers the feature test in them. But my other project build perfectly and the test aren't discovered. If I go to the test output I get the following FileNotFound / Converting error:
------ Discover test started ------
NUnit Adapter 3.6.1.0: Test discovery starting
Exception System.IO.FileNotFoundException, Exception converting Calculations.Calculations.Feature.SendANewQuote.SendANewQuote("18-1980","150","Yearly","1337","RiskProfile","email#email.com",System.String[])
Could not find file 'PathToCalculations\bin\Config\Calculations.pdb'.
It is the same for all my other tests in that project. I don't have that problem with my other project but all the references and packages are the same.
How can I fix this error so that the NUnit Test Adapter can do it's magic?
There was recently a change with either the adapter, or VS, that means a pdb file must be generated when using the adapter. There is an open issue to investigate this here: https://github.com/nunit/nunit3-vs-adapter/issues/276
It sounds like you might not be generating a pdb for the 'Calculations' project. You can turn it on by going in to the project settings > Build > Advanced, and selecting full or pdb-only from the Debug Info dropdown.

Running SonarQube without TFS Build?

I was asked to integrate another project (C#) into SonarQube. We use TFS 2013, SonarQube 5.1.2 with Sonar.MSBuild.Runner 1.0.
The Build process template is old (does not support pre and post Powershell scripts) and it is customized. Visual Studio 2013 is unable to edit the old build process template.
I tried to do just the static code analysis and run the MSBuild.SonarQube.Runner with the start parameter and a second time with the end parameter without doing a build in between (The code coverage does not seem important to them). But then I get the error "No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being build"?
What options do I have to integrate this project into SonarQube?
To use the MSBuild SonarQube Runner from the command line, you have to:
Prepare the environment: MSBuild.SonarQube.Runner.exe begin /k:SQ_project_key /n:SQ_project_name /v:SQ_project_version (pick arbitrary SonarQube project key, name and version)
Run your build: msbuild
Upload analysis results: MSBuild.SonarQube.Runner.exe end
The MSBuild SonarQube Runner integrates with MSBuild and collects informations as it builds your project: You must run the build during the begin and end invocations, or this mandatory information won't be available and the MSBuild SonarQube Runner will fail with the message you reported. The MSBuild integration is compatible with MSBuild versions 4.0, 12 and 14.
Regarding the integration with TFS XAML builds, if you're using a customized one, you'll have to customize it a bit more to integrate the calls to the beginand end commands of the MSBuild SonarQube Runner.
Code Coverage is supported out of the box on TFS 2013 with the default build definition template, you just need to run tests with coverage enabled. If that doesn't work for you, see this link on how to manually pass the code coverage results path property: http://docs.sonarqube.org/x/CoBh

Build succeeded but publish failed in VS 2013 for WCF

This question was already asked so many times. But the said solutions did not help. I tried to publish the WCF project. But it build successfully but failed on publish. I get the following message in output window.
I tried the following things
Checked the VS2013 having administrator rights.
Folders have permission to modify.
Changed the "MSBuild project build output verbosity" option to "Detailed"
above things did not give me solution. I attached my solution explorer for reference.
How can I resolve my problem?
I've ran into this issue before, the latest was while upgrading a WCF project from Visual Studio 2013 to 2015. The solution (with multiple projects) would build and run fine within VS but would fail when publishing the WCF service. No error in the publish step just the message:
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
The solution has always been in the project properties. In the latest case, was the Build > Platform Target which was setup as x64 by default in VS2015, which I changed to "Any CPU" and resolved my issue. I hope it helps.

TFS Build Agent skipping all tests

I've set up a build controller and build agent for my TFS 2012.
I have a .NET 4.0 project with coded UI tests that I would like to run there.
I set the build configuration to run with VS Test Runner.
The problem is that the test runner skipping all of my tests!
(I can see Skipped <test_name> for all my tests in the log view when I run the build with Diagnostic logging verbosity)
Any ideas?
update -
I've googled a lot on this and found that adding a .testsettings file in the build configuration should solve this, but when I added one, the build fails with the following error (found nothing about this error :( ):
MSTestAdapter could not run the test as the classic mode is not available. Reason: Exception has been thrown by the target of invocation.
Directory C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\DataCollectors does not exist
and with this warning:
No tests is available in . Make sure that installed test discovers & executors, platform & framework version settings are appropriate and try again.
To run coded ui test in build server, you needed to run the build agent as an interactive process (Build service property, Run as Interactive Process), you also need setup a test controller and an interactive test agent.
http://msdn.microsoft.com/en-us/library/vstudio/ms181712.aspx#interactive
http://msdn.microsoft.com/en-us/library/dd648127.aspx
in your testsettings you can sepcify the testagent and other settings
http://msdn.microsoft.com/en-us/library/ee256991.aspx

How do I get TestDriven.net to generate a useful code coverage XML file with NCover?

Steps to Repro:
Make a C# project in VS 2010 Professional on Windows 7 Ultimate 32-bit edition.
Write some unit tests with the VS C# Unit Test wizard
Download and install the latest RTM or Beta version of TestDriven.Net.
Right-click on the testing project and select Test With NCover
Wait
See that NCover's window is empty
How do I get TestDriven.net to generate a useful code coverage XML file with NCover?
So far, I've tried rebooting, uninstalling the RTM version and installing the Beta version, and running in Debug & Release modes.
Update with Output window text:
------ Test started: Assembly: TestProject1.dll ------
NCover v1.5.8 - Code Coverage Analysis for .NET - http://ncover.com
NCover.Console v1.5.8 - Code Coverage Analysis for .NET - http://ncover.org
Copyright (c) 2004-2006 Peter Waldschmidt
Command: C:\Program Files\TestDriven.NET 3\ProcessInvocation86.exe
Command Args: "/assemblyName:TestDriven.TestRunner.Server, Version=3.2.2770.0, Culture=neutral, PublicKeyToken=50ecb853f8c6b8d2" "/xmlName:M:TestDriven.TestRunner.Coverage.NCoverCoverageTestRunner.OutOfProc.Run(System.String,System.String,System.String,System.String,System.String)" "/parameter:tcp://127.0.0.1:64445/7dbdb535-3602-4a8e-8bbc-f8be7eb83987" "/parameter:tcp://127.0.0.1:64445/fbff4f73-2438-43e4-b1f9-2bdaeb9c0907" "/parameter:C:\Users\Zian\Documents\Visual Studio 2010\Projects\ClassLibrary1\TestProject1\bin\Debug\TestProject1.dll" "/parameter" "/parameter"
Working Directory:
Assemblies: ClassLibrary1;ClassLibrary1_Accessor;TestProject1
Coverage Xml: C:\Users\Zian\AppData\Local\Temp\Mutant Design\TestDriven.NET 2.0\Coverage\ClassLibrary1\TestProject1.xml
Coverage Log: Coverage.Log
Waiting for profiled application to connect...Connected
Configuring Profiler...
******************* Program Output *******************
Unable to establish communications with the profiler. (0x2)
NCover couldn't create a coverage report.
(Assuming you are using NCover 1.5.8 which ship with TDD.Net)
I've done exactly what you described, and it works just fine...
Here are some things to consider:
Are you sure the actual xml file is empty? Try to look for it here:
C:\Users\USERNAME\AppData\Local\Temp\Mutant Design\TestDriven.NET
2.0\Coverage\YOURPROJECT, or use something like Everything (great free search tool) to find YourTestProject.xml. Perhaps there is a problem with the NCover GUI.
There have been some problems with MSTest & NCover integration prior
to 1.5.8. Try to reproduce this with NUnit and see what happens
(Actually IMHO, I don't see any advantage for MSTest over NUnit
anyway).
Are you running any other profiler in addition to NCover? Is
so, try to disable them.
EDIT:
Try to follow the steps in this article. There's a section called "NCover With TestDriven.NET".
It seems as NCover's profiler is not registered properly, so mainly what you have to do is remove it manually completely (TDD.Net probably doesn't do it for you), and only then reinstall it.
Uninstall the Beta version of TestDriven.net
Install the RTM version of TestDriven.net
The 2 steps work because NCover's profiler is not registered properly, as described by KiwiDude.

Categories

Resources