Adam Rackis
Adam Rackis

Reputation: 83366

Unit tests not showing in Visual Studio 2013, and 2012

I have two closely related problems involving unit tests in Visual Studio 2012 and 2013.

In both versions, building the solution does not refresh my test explorer with new or removed tests, nor does it rebuild the existing tests (so they keep passing or keep failing no matter what you type).

Also, after upgrading from Visual Studio 2012 to 2013, I now have some unit tests failing with the following error

Result Message: Test method BE2.Database.Tests.BulkNotificationTests.BulkAll_Fail_ActionReSpecified threw exception System.BadImageFormatException, but exception System.ArgumentException was expected. Exception message: System.BadImageFormatException: Could not load file or assembly 'BE2.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. Result StackTrace:
at BE2.Database.Tests.BulkNotificationTests.RunBulkNotificationsWithNoChecks(IEnumerable1 recordIds, IEnumerable1 jsonObjs, IEnumerable1 actions, IEnumerable1 customRecipients, String singleAction, Object singleJson) at BE2.Database.Tests.BulkNotificationTests.BulkAll_Fail_ActionReSpecified() in c:\GIT\MainLine\tests\BE2.Database.Tests\BulkNotificationTests.cs:line 337

The tests continue to pass when I open the solution in VS 2012, but continue to error out like this in 2013. I've restarted VS multiple times, and even rebooted my computer.

Upvotes: 1

Views: 1016

Answers (1)

Alan
Alan

Reputation: 466

This is a 64bit vs 32bit issue. You'll have to set the process architecture of the test runner to match the build configuration for your test projects and the projects they are testing. By default the test runner runs as 32bit.

You can check your build configuration by going to Build > Configuration Manager. You can check your test settings by going to Test > Test Settings > Default Processor Architecture.

Also, to make sure your tests refresh after building your solution, make sure that the Build checkbox is checked in configuration manager for the test project in question.

Upvotes: 3

Related Questions