开发者

Is it possible to run tests as the `Local System` user?

I'm writing an integration test that requires the method to be run in the Local System security context to achieve the desired behavior. I couldn't achieve this yet. What should I do?

I'm using C#, VS 2010, MsTest and the target project is a Windows Service app开发者_Python百科.


I see two options.

You can write a Windows service.

This is not as much work as it sounds. You can have that listen for commands, using e.g. WCF. If you set the privilege of that service to Local System you can have that service run your unit tests.

You can use scheduled tasks.

If you want your tests to run periodically, you can use scheduled tasks to schedule the task with the Local System privileges.


This post could help you: the author is talking about running cmd as local system, but shoud work with nunit.exe as well so...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜