ReSharper Unit Test Covarage not showing coverage - unit-testing

When running ReSharper Unit Test Coverage in Visual Studio 2019 v.16.11.10 with ReSharper v.2021.3.3, the coverage on the files is not shown/run.
On the image, a snippet of the Unit Test Coverage is shown, where it is seen that the unit tests are run and how much of those tests are covered. Unfolding one of the packages that should be tested by the tests, it is possible to see that ReSharper cannot generate coverage. Is this because all the functionality is packed into the (1.0.0.0, .NETFramework, Version=v4.7.2)?
If this is the problem, is there any workaround? Or how do I get rid of the line if it causes any problems? If I then get rid of the line, will everything then be packaged in a different manner? Or will everything work the same as before?
One of the other projects in my team does not have this extra line where everything is packed into, and ReSharper can generate Unit Test Coverage as it should.

Related

Code Coverage in python without unit tests

I have a python (Django) application for which I want to generate a code coverage report, but the solutions I have found on the internet mostly work with test runners or requires unit tests for example Coverage.py and pytest-cov. As I don't have unit tests for my code, is there any other options available that can do the coverage for my code without unit tests?

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

How to unit test in ScriptSharp

We noticed that there was a unit testing project within the latest Script# 0.8 code on the Git repository, but there is no documentation as to how to actually use it, and the example files don't seem to work correctly.
Having stepped through the source code, we can't actually see any test code within the unit test files.
Has anyone else managed to successfully run unit tests against Script# within the Visual Studio IDE?
The AroundMe sample at https://github.com/nikhilk/scriptsharp/tree/cc/samples/AroundMe demonstrates unit testing.
In short, there are two parts -
1. The Tests subnamespace within your project containing tests alongside code being tested. Test code gets split out by the compiler to generate a Foo.test.js alongside Foo.js and Foo.debug.js.
A test project which provides a driver to launch unit tests in browser and capture results of QUnit to surface into VS unit testing UI. This is optional... you could run the Foo.test.js manually using QUnit yourself if you've got your own pipeline for executing tests.
Hope that helps.

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

integration test - unit test seperation and best practices with visual studio 2010 + tfs

In our big application written with C# we have automated tests.
Some of tests are integration tests; they are mostly testing integration points with other systems, they are slower than unit tests and to get them to succeed on a new machine some configuration is needed.
Some are unit tests; they are much faster, do not need any configuration.
In related test projects we have two folders in general: UnitTest and IntegrationTest. Hence I have not an option to run them seperately.
What I need is, clear seperation between unit and integration tests. I want to be able to run only integration tests or just unit tests.
How can I achive this seperation? What are your experiences on the subject?
In visual studio go to the Test menu > Windows > Test List editor. All test methods can be selected/deselected in this window. At the top left click the arrow and choose Run checked tests or debug checked tests.
You can also use the TestCategory attribute (just Category in NUnit). Then run the tests in that category.
something like TestCategory("Unit") or TestCategory("Integration")