TestInitialize not being called for Windows Store Unit Test Project

I'm evaluating dotCover for a Windows Store Application and I'm trying to cover some unit tests for this using an MSTest unit test project (using VS2013). In my tests I'm using a Initialize method with the TestInitialize attribute to set up some stub classes. When I try to run the "Cover Unit Tests with dotCover" the tests always fail and when I check the coverage it shows the Initialize method in pink indicating it was never run, thus causing exceptions in my unit tests.

However when I just run the unit tests normally then the Initialize method does get called and all my tests pass. I also tried a console application with a unit test project and dotCover has no problem calling the TestInitialize method there. Is there some configuration setting I'm missing so that "Cover Unit" tests will succeed in Windows Store unit test projects?

5 comments

Hello Sean,


Do you work with dotCover test runner or with ReSharper test runner? You can check this here: ReSharper | Options | Tools | Unit Testing and dotCover | Options | Unit Testing.
Could you please send us a sample solution where this problem is present?

Kind regards,
Maria

0

I was initially using the dotCover test runner (I usually use ReSharper but it is not installed on the machine I had installed dotCover on). I also tried the MS Test test explorer and this ran the test successfully. Below is the options window I'm using for dotCover

dotCoverOptions.png

And these were the results:

Unit Test successful Cover not successful
unittest_dotcover.png cover_dotcover.png



When the "cover unit tests" was run, the unit test Initialize method was in pink:

pink.png

I've attached the sample Windows store project with this small test. Thanks for your help!



Attachment(s):
DotCoverTest.zip
0

Hi Sean,

The issue http://youtrack.jetbrains.com/issue/DCVR-6889 is already fixed and the fix will be included in the next release.
Current workaround is to disable "Collect per-test information for WinStore tests" in dotCover | Options | General.

Best Regards,
Fedor.

0

That's great, thanks for your help - is there a release date for the next version?

0

Hi Sean,

You are welcome to try recently released dotCover 2.7.2, it contains the necessary fix: http://www.jetbrains.com/dotcover/download/index.html

Best regards.

0

Please sign in to leave a comment.