VS2017 Enterprise Code Coverage Doesn't Do It's Job - visual-studio-2017

The code coverage tool in VS2017 enterprise no longer shows what application code is covered. Whether I run it on selected tests or all tests, it shows what code in the unit tests are covered, but shows the code actually being tested at 0%. When I first started using the tool it worked just fine and showed application code coverage. I only check coverage occasionally, so I'm not sure when it broke or what I might have done to cause the issue. I'm thinking that there is something in the Registry that is causing it since I haven't been able to find anything in Tools/Options/...
I installed JetBrains dotCoverage and it does the same thing even when I exclude the unit test project from the coverage session. I've tried to repair the VS installation. My next step is uninstall/reinstall. However, unless that cleans up the registry where I think the configuration error is, it will fail to address the problem.
So any suggestions on where I can look to figure this out would be appreciated.

Related

NCover not finding unit tests

I am trying to install NCover in an existing C# .NET project for work. Unfortunately, after I download NCover and installed the Visual Studio extension, it wasn't finding any of the unit tests. The answers I've seen/heard seem to be in the vain of 'It wasn't working...time passed...it started working.'
I can run the tests with Visual Studio's Test Explorer, but I need to get NCover installed to see the code coverage. I had NCover installed previously, and other people on my team are getting it to work within the same project.
I am using Visual Studio 2013 with the newest version of NCover Desktop (v 5.1).
I am getting two errors in the console log.
The first switches between saying:
Agent Error (v4x64): An error occurred while loading assembly
and
Agent Error (v4x64): There was a problem loading test assembly [test path]. Could not get bytes from loader AppDomain
The second (after I try to run NCover) says it 'Could not load config' for the test dll.
I copied the 4 XML config file (Bolt.ext.config, Bolt.Extension2008.dll.config, NCover.exe.config, ncover.axplorer.exe.config) from one of my team members, so I'm pretty sure that I have my config correct.
Has anyone else experience this/have any suggestions? Help would be greatly appreciated!
Further information:
When I hover over the grayed out test dll in the bolt test panel, I get the following error:
Assembly is not loaded. Select and run to build and load this assembly
I was looking at this post, but it doesn't seem like any of the solutions are working for me...
After working with some of the other developers in my office, we discovered the issue was with the NCover version. For our tests to run, we needed to use NCover v5.0. Neither v5.1 or v5.2 would work with our setup. Not sure what changed in v5.1 that wouldn't let it find the tests, but I'm glad it's working now :)

CUITe test execution fails under VS2015

Using CUITe testing framework in VS2012, I created a coded UI test. This test works as expected when right clicking the test, and hitting "run test" in VS2012.
We are in the process of migrating to VS2015, so I'm trying to go through our solutions to make sure they are behaving as expected. In this solutions case, we are running into an issue where when attempting to run a test, the output pane states:
There is no test with the specified Id (guid listed)
And no CUITe tests are run.
I have confirmed that normal coded UI tests are running in VS2015, it is specifically coded UI tests created using CUITe that are failing to run.
Don't know if anyone will have any workarounds for this, but I figured I'd give it a shot. I have additionally added all of the "Microsoft Testing" dlls to the solution in a separate folder, in order to ensure the solution is using the "specific versions" of the testing DLLs. This did not solve the problem.
The issue was due to CUITe not having been compiled/provided a build definition for VS2015.
In the current GitHub repo of CUITe (code plex URL from the original question no longer the "active link") provides a new build that addresses the issue.
Current URL for CUITe is:
https://github.com/icnocop/cuite
Issue was resolved here.

TeamCity reports incorrect code coverage with dotCover for c# unit tests

I am somewhat new to TeamCity. I have set it up for a Visual Studio solution.
I am using NUnit step to run unit tests and dotCover for code coverage. Problem is, there are particular parts of my code that I know are covered by unit tests but in the code coverage report, it shows them with zero coverage.
I know the DLLs are created just fine because I run a dir /s command and can see all the test DLLs.
The NUnit step uses MSIL 4.0 platform and the test path looks like this:
**/bin/Debug/*Tests.dll
There are no filters under code coverage.
Many tests are run. But there are some specific tests that are not present in the search report when I search.
Why is this happening and how do I fix it?
Can you please provide information about your NUnit step, especially about .Net Coverage (Filters).
Can you also confirm that tests are actually run?
Full build log (pasted in pastebin.com or such provider) would be also appreciated.
Stupid me. The DLL that was being ignored was spelled *Test.dll instead of *Tests.dll. I use *Tests.dll in my test path.
The issue got fixed once I changed it to *Test*.dll

Problems with DevPartner

I have installed DevPartner and I am using visual studio 2010.
However, when I launch 'Start with coverage analysis', nothing happens.
In the videos, they show that in the under Options->DevPartner->Code review, there should be a list of projects. But I do not see such list.
It will be great if you could please help me with it.
Many thanks.
Chintan
Coverage analysis ans Code review are 2 separate products in the Devpartner Suite.
Coverage Analysis is to used to determine which lines of code are executed in a run of your project. You can also merge several runs to get an overall idea of how much code you have exercised. Coverage analysis works for both Native (C, C++) and managed languages.
When you launch your application with coverage analysis you will only see a small toolbar appear that allows you to take snapshots or stop recording coverage information. After your program exits a final session will be collected and displaying in Visual Studio. Unless something is wrong with your license. Another problem would be when launching Visual Studio and opening your project you may see an error unable similar to Devpartner start session control service.
Code Review is used as static analysis of Managed (.Net) code. It does not run your project but analysis the code in your projects and determines if any of that code violates the rule set you selected to run against.

How to enable code coverage without using Visual Studio?

I have 80+ VS2010 solutions, each contains some unit test projects.
All solutions are merged into one big solution before build process.
All tests (or some test subset) are executed after the successful build.
I want to enable test code coverage for all tests to get exact code coverage for all output assemblies.
My question is: how to enable code coverage without using Visual Studio?
Note: I'm using TFS2010 (MSBuild) to build merged solution. VS 2010 Premium is installed on the build server. MSTest is used for test execution.
You can use JetBrain's TeamCity Professional. It is a CI server that supports executing unit tests and calculating code coverage. It is free for small installations.
I think you need to consider deploying a code coverage tool, see here for a comparison (provided you implement .net).We use NCover, which integrated in our TFS-Build in it's console variant and, although it's not trivial to set it up, we 're very satisfied with it.In this post I had briefly described how we inserted NCoverin our build, this might we useful to you even if you go with another tool.
If you create a Vsmdi file in your large solution (ms test will usually do this for you) you can use this to tell the build which assemblies you want to instrument.
This will only provide code coverage for assemblies that have tests run against them. If you're using testrun.config files to decide which tests you want to run, this should be all you need. The code coverage results should then be published to the build drop location
Edit:
This blog post looks like it covers setting up code coverage