3

I have source code and unit tests in two different solutions. The test project refers to the source code binaries. How can find the code coverage? If I select "Analyze code coverage" Menu under "Test" menu, Visual studio shows the coverage, but it looks like coverage for test code and not for the source code. When I double click on a test from the code coverage window the highlighting happens for Test code. There is no way to see the code highlighting that could show the covered code in the source code(code under test) which is actually in different solution. I'm using Visual studio 2012 and Nunit(through Nunit Visual studio adapter) as my unit testing tool.

1
  • 1
    Is there any reason why your tests and your source code aren't in the same solution? Commented Apr 15, 2015 at 21:40

2 Answers 2

0

Please state more precisely how you're running your tests - NUnit or VS Test Runner?

However, if you are using NUnit to run the tests as it is tagged in this question, then take a look at the "OpenCover" tool (just google it).

OpenCover is able to launch your Testrunner (and every other executable), then doing the instrumentation and producing a coverage result.

It is easy to configure, e.g.:

OpenCover.Console.exe -register:user -target:Target.exe -filter:+[*]* -output:output.xml 

The typical use is to run this in a batch and add an ReportGenerator step afterwards.

We're using it this way within our Continuous integration System (Jenkins).

Sign up to request clarification or add additional context in comments.

Comments

0

Try using a tool such as NCover. I had to do that like you for product code and test code which were in different solutions. It worked. However, you have to read documentation and adjust the settings. Sadly, I forgot those details.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.