Visual Studio 2012 - code coverage - how to do it right?

I am trying to automate code coverage with unit test. I have done the following:

  • Metro app with some features created.

  • Created Unit Test Library (for Metro application) - in the same solution as my application (see above).

  • One test class has been added that contains several test methods.

  • To compile the test library, I added a link to the class created in my application (Add-> Existing Element-> Add as Link ".

  • Remote tests under VS - successfully.

  • Remove tests from the console using vstest.console.exe - successfully.

Now I need to calculate the code coverage for my application. I know that vstest.console.exe has the ability to enable code coverage, but I am using the express version of VS, and this feature does not seem to be available there.

Question: How to use vstest.console.exe (or any other tool) to get the correct code coverage. The tool accepts a test library project application, so it calculates coverage for code from the library (mentioned one class from the application), right? How does tu use a tool to port a library with test code and an application with all the code?

+4
source share
2 answers

Code Coverage Available in Premium and Complete Taste Visual Studio 2012

However, please note that we have not yet included code coverage for Windows Store applications back in VS 2012.

+4
source

We use the OpenCover tool to cover the code. This displays a report of the xml results. Then we pass this xml file to ReportGenerator to create a beautifully designed html report.

+3
source

Source: https://habr.com/ru/post/1440546/


All Articles