0

Using: NUnit 2.x and VS17

I have a bunch of tests that are executed based on data that I load in from an Excel Workbook. This works fine when I'm doing a standard run of my tests.

Now I am interested in seeing what sort of Code Coverage these tests have, which I've done with several other non Excel reliant tests in the solution. The application does however hang at this line specifically when ran with Code Coverage Analysis from the VS Test Explorer.

_excelApp = new Excel.ApplicationClass();

I've tried things that don't concern my case specifically, but I figured might work from both of these threads: thread_1, thread_2

Lastly I've tried to use the attribute [ExcludeFromCodeCoverage] on the method from which the above line is called, also with no luck.

Any ideas for a solution for this issue or can I simply not get Code Coverage from an Excel reliant test without major workaround?

Community
  • 1
  • 1
Emil L.
  • 97
  • 10

1 Answers1

0

I had the same issue and managed to get the code coverage by removing a line that I have added just after:

_excelApp.Visible = true;

Have you done the same?

If I remove that the code coverage is running but I cannot be able to test my User Defined Function without this Application visibility, that's not the best workaround ever, but working so far. If you find a better solution I'd be happy to know.