nunit/nunit-framework — pull request #191 by CharliePoole (2014-08-22 02:20:11+00:00)
Title: Issue text capture

This pull request incorporates changes to text handling in the framework as discussed on our list. More work is needed before merging, including a corresponding change to nunit-console. I'm putting it out now so it gets a good review. This is a major change of direction for NUnit.

1. All special handling of Log and Trace output is removed. If we elect to do this in the future, it will be by means of providing special listeners to which users can direct their trace/log output. In fact, I don't think that's too likely. Rather, we will encourage users to use external tools to merge various kinds of time-stamped output.

2. Most special handling of Console output has been removed. All that remains is the redirection of console output to a file. The framework still handles this by directing text output to a queue because that's the only approach that will work when we are running in multiple processes. However, NUnit no longer makes any attempt to assign specific output to a test due to issues that arise from running multiple tests in parallel.

3. Out and Error properties are removed from TestExecutionContext. These were intended for use in turning text capture on and off via an attribute, which was never implemented.

4. In compensation for what is removed, TestContext gets a static Out property and a large number of static Write and WriteLine methods. Output written to the TestContext ends up as part of the TestResult. The output appears in the Xml output file and is received by the test harness when the test finishes. By doing it as part of the result, no deduction is necessary to know what test created the output. We will encourage users to stop using Console writes in their tests and convert to use of TestContext.

5. As an unrelated change, I also removed CurrentDirectory from TestExecutionContext. NUnit no longer changes current directory or restores it after user changes, so the mechanism for tracking it can be removed.

What remains to be done before a merger...

1. I'll go through and find any further remnants of text-related code that should be removed. Suggestions?

2. I'll make sure test labelling works in the harness and nunitlite

3. I'll create a new pull request with the same name for NUnit-console.