2

I'm working with Visual Studio 2012 and I'm developing some integration tests using Visual Studio's test framework (mstest).

Some days ago I found some info regarding that now Visual Studio 2012 can execute tests in the output directory (i.e. bin\Debug, bin\Release) and I disabled deployment in order to simplify a lot of things.

Although most of the things worked as expected, I found a big problem: some [ClassInitialize] code executes a process using Process class and, just after disabling deployment, whenever a process is launched, I get this error:

enter image description here

My first impression was that maybe something in the process launching was incorrect and I copy-pasted the same command and arguments into a CMD and it worked as expected.

After some investigation, I figured out why happened this: because I configured test runner to be launched as a 64bit process. After switching to X86, for example Process.Start("cmd") worked.

But what's worse is SQLCMD - the actual process that I'm launching within test run - still fails with the so-called error.

This error happens when any process is launched within Visual Studio test runner.

What happens with SQLCMD when launched from a test runner?

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206

1 Answers1

1

After a lot of trials and errors finally I've solved the problem.

  • Now I can run tests as a 64bit process (I thought this was the main problem but I was mistaken!).
  • I can still run tests from the output directory!

But what I had to change to get it work properly? The .runsettings file. It was just commenting out <DataCollectionRunSettings> XML element... And suddenly SQLCMD process started to work again!

I really don't know why commenting out that configuration element did the trick, but the point is that, as I only want integration tests and run them "as is", this solution is fine for me.

Anyway, if anyone can explain why commenting out <DataCollectionRunSettings> elements makes this effect, it'll be appreciated.

Thank you anyway!

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206