Reputation: 18895
I'm a contractor doing some unit tests that use Windows authentication to hit a test server in a different domain. I've been running my tests on my clients VM and everything has been running fine since I'm on their network, and using my login credentials on their domain to run the unit tests. Unfortunetly the VM is extremely slow, (it took 30 minutes for the server to reboot, and for me to bring up the 14 project solution) and I decided to try and run VS on my laptop. I was able to get it to build just fine, but when I go to run my unit tests, It errors out when it attempts to access the test server since I'm running as myself on my laptop which is not in their domain.
Is there any way to run the unit tests as a different user?
I tried using C:\Windows\System32\runas.exe /netonly /user:theirDomain\uid "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" to run the tests, but it doesn't work (I'm guessing because the unit tests actually run as QTAgent32.exe that it doesn't work). I have been able to use the same command for SQL Server Manager to connect to their SQL server.
Another option may be to figure out a way to trust my user credentials on their domain on my laptop, but that isn't working either...
Upvotes: 4
Views: 3144
Reputation: 2817
If you have domain account - you can raise VPN connection or add your laptop to their domain.
Upvotes: 0
Reputation: 2984
You can run the unit tests directly using the command line application mstest.exe. This is what VS is doing under the hood. In conjunction with runas.exe, I think should completely solve your problem.
Reference for mstest.exe: http://msdn.microsoft.com/en-us/library/ms182489(v=vs.80).aspx
Edit: I'd just like to say that in the interest of efficiency I think the ideal solution here would be for their sys admins to create a domain account for you to use.
Upvotes: 1