I have some unit tests that run fine on my dev machine on both the Win Mobile 5 and 6 (Professional) emulators.
Running on a build server some of the unit tests fail, but only on the Win Mobile 6 emulator (all tests pass on the Win Mobile 5 emulator).
The tests that fail have errors like:
Test method XXXXXMobile.Test.ManifestTests.TestCrewManifest threw exception: System.MissingMethodException: Could not load type 'XXXXXMobile.Controllers.ManifestController' from assembly 'XXXXXMobile.Controllers, Version=1.0.4049.32739, Culture=neutral, PublicKeyToken=null'..
and
Test method XXXXXMobile.Test.PermissionTests.TestMenuBarPermissions threw exception: System.MissingMethodException: Method not found: op_Implicit System.Object..
The command line that sets off the tests is:
C:\hudson\jobs\XXXXX Mobile (WinMobile 6 Emulator Tests)\workspace>e:\VS9\Common
7\IDE\MSTest.exe /runconfig:YYYY\WinMobile6Emulator.testrunConfig /testcontainer
:YYYY\XXXXXMobile.Test\bin\Release\XXXXXMobile.Test.dll
The testrunconfig file is unexciting. I think the only things I changed from the default were: - Enable Deployment: Checked - Host Type: Smart Device - Platform: Windows Mobile 6 Professional SDK - Device: Windows Mobile 6 Professional Emulator
The directory containing the test run container dll also contains the Controllers dll that is mentioned in the first error above.
Having banged my head against this for a while now, I am at a loss as to why only some tests are failing and only on one machine and one emulator. I have been unable to get any more helpful error message by turning on diagnostic logging on both MSTest.exe and VSTestHost.exe.
Any suggestions gratefully received.
And as so often happens, the answers appears shortly after asking the question.
In this case the problem was that the emulator on the build server did not have .Net 3.5 installed. Running the application from VS will install .Net 3.5, but running the unit tests does not. On the dev machine I had already run the app and then saved state (to save having to re-install .Net 3.5 every run). This had not been done on the build server.