Mstest module tests exit command line

I wrote a unit test file that uses the testsettings file to deploy some referenced dll in the OUT folder. I ran a unit test using this command.

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" 
"/testcontainer:C:\Unittests\unit_test.dll" 
"/runconfig:C:\Unittests\unit_test_settings.testsettings" 
"/resultsfile:C:\Unittests\unit_test_results.trx"

      

Some tests in my unit test work fine, but some of them fail with the following error.

Object initialization error (ISupportInitialize.EndInit). The satellite assembly named "some_referenced_dll.resources.dll, PublicKeyToken =" for the fallback culture "en" either could not be found or could not be loaded. This is usually an installation problem. Please consider reinstalling or repairing the app.
System.Resources.MissingSatelliteAssemblyException: The satellite assembly is called ...

In an attempt to fix this, I added some_referenced_dll.resouce.dll as a deployment item in the testettings file, but it didn't help.

I see dlls being copied to OUT folder.

Also, the tests work fine with VS 2012 after adding some_referenced_dll.dll as a project reference.

ADDITIONAL INFORMATION:

There are tests that use some other dll as refrence directly (say ref_dll_2.dll) and pass. This ref_dll_2.dll file is also located in the OUT folder.

I ran into a problem with a dll (some_referenced_dll.resouce.dll) that is not directly referenced in my test. My unit test call into some dev code that inturn tries to initialize the class, which fails.

Would it be advisable to force the DLL to load? Is there a way to do this?

+3


source to share


1 answer


OK, so I finally fixed the problem. Documentation here for completeness.

The problem was that my MSTEST unit test was unable to find the resource / satellites assembly (some_referenced_dll.resources.dll) and thus was throwing an exception. I used deploymentItem attribute for deploying dll (some_referenced_dll.dll) but not resource DLL. The solution was to use deployItem and deploy the resource dll (some_referenced_dll.resources.dll).



Bill Wang provided a great answer in this thread that helped solve the problem. It was a simple solution to a really annoying problem.

+2


source







All Articles