Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running tests as a different user in Visual Studio

I have a program that needs to run as a separate NT user to connect to a SQL Server databases. For running a program itself, this isn't a big deal as I can just right click on it in windows explorer and select run as. Is there any way to run my tests as a different user as well? (it would be nice if I could do so in Visual Studio)

Update: As of right now, I'm just unit testing using the integrated unit testing framework in Visual Studio 2008 Pro. I'm running them just using the "run all tests in current solution" menu option.

like image 726
Jason Baker Avatar asked Nov 05 '22 22:11

Jason Baker


1 Answers

There's a command line program "runas", which you can use to run your tests as long as they are standalone programs. I'm not sure how exactly to integreate it with your tests, as I may need a bit more information on how you run them.

This method will ask you to enter your password.

like image 82
Raymond Martineau Avatar answered Nov 12 '22 20:11

Raymond Martineau