Running Tests Under Another User in Gallio/MbUnit v3.3

It may be convenient sometimes to run test methods under a user account other than the one running the current test session. For example, you might want to test some security feature and see if it behaves correctly according to the level of credentials of a particular archetypal user.

MbUnit provides a very simple attribute that does exactly that: ImpersonateAttribute. To use it, decorate the test methods (or the entire test fixture) with one or several instances of that attribute and feed them with valid user names, passwords and optionally a domain.

You can find more details and a few samples on the Gallio Wiki.

No comments: