MSTest.exe error

Hi,

When I run my unit tests using the IDE all my tests passed and when I run the same tests using MSTest.exe all the tests failed. Please advice!

Thanks,



Answer this question

MSTest.exe error

  • Richo

    I think I need more info, maybe you have some kind of precondition you need for run unit tests which is not executing correctly when you run them from command line like copy to unit test run folder some test files or some connection to database

  • Kolchak

    I am getting this on all tests MyClassInitialize threw exception. System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object..


  • David Sceppa

    Hello,

    You can try several things here.

    1. If you're using a testrunconfig file and you're specifying deployment files there, make sure you call it from the commandline,
    MSTest.exe /testcontainer:MyUnitTest.dll /runconfig:localtestrun.testrunconfig

    2. If you're not using a testrunconfig file (you don't need deployment items for all of the tests in your project), you can specify attributes in a per test basis; use the DeploymentItem attribute and specify an absolute path to your reference

    3. Make sure you added all references to your project as Projects references (from the Add reference dialog, hit the Projects tab).

    If these do not solve your problem, take a look at this thread that may be helpful:
    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=324809&SiteID=1

    Please let me know if this helps

    David Gorena Elizondo
    [MSFT] VSTS


  • Ting-fang Zheng

    With only this info, I can only say, check if you're giving to Mstest, the right path and name for the test config file, and vsmdi file, maybe he is trying to localize some kind of configuration he doesn't get it, but it's strange, it checks this files first of all

  • zaidm

    I deleted my ClassInitialize() and now when i run the test the assemblies references are not getting copy to the out folder on test results. Please advice!

    Thanks,


  • MSTest.exe error