Not able to run unit tests when Visual Studio 2010 and Visual Studio 2012 are installed side by side?

If you are not able to run unit tests when VS 2010 and VS 2012 are installed on the same machine, then please read on. There is a known issue here and this post talks about how you can verify that you are running into the same issue or not and secondly how you can come out of it.

If you are running into the same issue, then you will observe that the test run is stuck and is not proceeding at all. This behavior is applicable for runs initiated from VS as well as runs initiated from MSTest or MTM.

To confirm whether you are hitting the same issue or not, you can try out any of the following steps.

  • Enable the test agent logs (QTAgent32.exe) and you should observe the following error in it.

QTAgent32.exe, PID 1944, Thread 6) AgentObject.OnBackgroundSendTestMessage: Connection to controller was lost. System.Runtime.Remoting.RemotingException: The argument type 'Run {b664e4b9-5d75-43b8-a8d3-95af9bf880bf}, Test {ccee0286-b042-4feb-bb72-7fbea29f9bc0}: Started' cannot be converted into parameter type 'Microsoft.VisualStudio.TestTools.Common.TestMessage'. ---> System.InvalidCastException: Object must implement IConvertible.

Or

  • Try running the test using MSTest and observe that by default it gets stuck but if you execute it /noisolation switch, then it works fine.

To fix this problem, you should upgrade your 2010 component (VS or test controller or test agent) to 2010 SP1 and after that it will work perfectly fine.