0

I am building a test suite, specflow and XUnit based, that has all kinds of end to end tests that run a few legacy .net 4.5 applications

The legacy applications hardly have any unit tests. I would like to see the coverage of the code that runs in the legacy application(s), using the end-to-end tests. I know it would be preferable to have proper unit tests, but because of the way the code is written that is a no-go at the moment, the architecture makes it very difficult. Is there a way of doing that by using DotCover and/or Coverlet?

1 Answers1

0

My experience may be slightly different as I have dotCover as part of Jetbrains Ultimate package with Resharper.

If you run dotCover in isolation then you can run an application as you would normally. When you capture a snapshot it will show you the test coverage as a percentage for each part of the code exercised. I tend to run this on a debug build.

If you export the results as HTML and then view them, you will be shown the coverage in a window pane on the left and by selecting a section on the left the matching area of code on the right: enter image description here

Within Visual Studio you should be able to select to "Cover All Tests" or if you start a test session you can select (highlight) Unit tests to run and then select "Cover Unit Tests". You'll need to ensure that you run the unit tests using the Jetbrains/dotCover menu option and not the MS test. The cover version has a little shield symbol next to it.

This will run the highlighted unit tests and give you a coverage output. You can then export the report as HTML or select the code files within Visual Studio and it will show you areas tested and passed (each line will have a green marker on the left) or untested or failed (each line will have a red marker on the left).

enter image description here

ChrisBD
  • 9,104
  • 3
  • 22
  • 35