RunAs System

TAEF runs the test as Local System.

Note The tests that you run as Local System should not create any user interfaces (UI). If your tests need to create or interact with UI, you need to move your UI-related code into separate executables that are launched on a desktop from your tests using CreateProcessAsUser function.

Specifying RunAs on the Command Line

te unittests\* /runas:system

Marking Tests with RunAs

Test metadata can be used to specify the runas type of an assembly, class or test method.

Note RunAs values specified in metadata override RunAs values specified on the command line. For example, a test marked with runas:system test metadata will still be run as Local System even if /runas:elevated is specified on the command line.

Example (native code)

class MyTests

        TEST_METHOD_PROPERTY(L"RunAs", L"System")

Related topics


Send comments about this topic to Microsoft