4

My setup is as follows:

  • Visual Studio 2015 Professional 2015
  • ReSharper Ultimate 2016.1.2
  • NUnit 3.4.1

Due to palatalisation, NUnit 3 does away with showing Console.Write output on the fly in the test runner window (see this documentation page). This creates an issue when wanting to view output while the test is running as described in this NUnit issue. The resolution (as I understand it!) was to introduce TestContext.Progress to be able to write on the fly to the test output window (in the NUnit console). However, I've tried this with ReSharper and it is not getting displayed at all (even after a test finished running).

Summing it up:

  • Console.Write gets appended to the test result output after the test finished running
  • TestContext.Write (short for TestContext.Out.Write) gets sent directly to the test result output, but it is only displayed after the test finished running
  • TestContext.Progress.Write will be sent straight to the console on the fly
  • Resharper will display TestContext.Write & Console.Write after the test finished running and TestContext.Progress.Write not at all

Can ReSharper display any output on the fly? Which method should be used for that purpose?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ory Zaidenvorm
  • 896
  • 1
  • 6
  • 20

1 Answers1

3

The Console class has a SetOut method which lets you redirect the output to some TextWriter. You can use this inside your test fixture setup.

This worked for me when using the ReSharper test runner on a similar setup:

Console.SetOut(TestContext.Progress);
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
nirw
  • 225
  • 2
  • 10
  • 2
    But this directs Console to TestContext.Progress which would not seem to solve the problem of text sent to TestContext.Progress not being displayed. If anything, it should make it worse. – Oskar Berggren Aug 23 '19 at 07:50