2

We have a testing environment using Visual Studio 2013 and MSTest where we need to run a setup script (.cmd-file) before starting certain test runs. Currently we are using .testsettings files for this purpose, which works great.

However a problem arose when we started using MS Fakes and shims, because debugging tests using the ShimsContext throws a UnitTestIsolationException with the error message Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.

The way to resolve this appears to be to change to a .runsettings file instead, to use the Visual Studio testrunner instead of MSTest. But how can we specify a setup script to be run once before the entire test run using this file format?

DeCaf
  • 6,026
  • 1
  • 29
  • 51

1 Answers1

1

You can call your *.cmd scripts from initialize and cleanup methods.

Check this: How to create Startup and Cleanup script for Visual Studio Test Project?

Community
  • 1
  • 1
Elena
  • 1,928
  • 1
  • 15
  • 23
  • The assembly initialize/cleanup would be the best course here, if it is not possible to run the setup/cleanup just once for the entire test run, which is what I would really like to do. – DeCaf Feb 09 '14 at 16:54
  • Sounds like you have more than one assembly, right? I don't have a better suggestion, sorry for that! – Elena Feb 09 '14 at 18:20
  • Yes, I have more than one assembly. Well, no need to apologize... If it is not possible to do this via the .runsettings file, this is probably the best approach. In this case I would just like to have it confirmed that it is indeed not possible to configure this in the .runsettings file. – DeCaf Feb 10 '14 at 09:31