Each NUnit test runs in an execution context, which includes information about the environment as well as the test itself. The TestContext class allows tests to access certain information about the execution context.
This class has been present in NUnit since 2.5.7, but was undocumented until the 2.6 release. Those earlier versions of TestContext are not covered here.
The context of the currently executing test may be accessed by use of the static property CurrentContext, which gets a reference to the current TestContext. This context is created separately for each test before it begins execution.
All other properties apply to the TestContext instance returned by CurrentContext. Note that the context may not be changed - all properties are read-only.
Gets a representation of the current test, with the following properties:
Gets a representation of the test result, with the following properties:
Gets the full path of the directory containing the current test assembly.
Gets the full path of the directory to be used for output from this test run. The XML result file and any redirected output files are located under this directory. This is normally the directory that was current when execution of NUnit began but may be changed by use of the /work option of nunit-console.