Console.WriteLine, Debug.WriteLine and TestContext.WriteLine message doesn't show up

704 views
Skip to first unread message

Kaleem Uddin Mohammed Abdul

unread,
Nov 1, 2017, 10:53:31 PM11/1/17
to NUnit-Discuss
Experts,

Console.WriteLine, Debug.WriteLine and TestContext.WriteLine message doesn't show up either in Output window or in Test Explorer->Output (link)->Message

one more weird thing I observed that when I don't have Debg.WriteLine the error message stack trace  along with output link doesn't shows up in TestExplorer window.

When I add Debug.WriteLine then only stack trace along with output link doesn't shows up in TestExplorer window.



I am using Nunit Adapter 3 and VS 2015 and .Net Framework 4.5

Charlie Poole

unread,
Nov 2, 2017, 12:02:57 AM11/2/17
to NUnit-Discuss
Hi Kaleem,

`Debug.WriteLine()` has nothing to do with NUnit. Whether it shows in your output windows depends on VS.

Both `Console.WriteLine()` and `TestContext.WriteLine()` are captured by NUnit and associated with the test that performed the write. When the NUnit adapter reports the test result to VS, the text output is saved so that it will be displayed in the output message.

However, NUnit only reports individual test cases to VS because that's all that VS handles. Your test fixture is, of course, also a test and may have output associated with it. Since you have an error in your OneTimeSetUp, the output must be coming from there. But because it's a message from the fixture, not from an individual test, it never gets reported to Visual Studio.

--
You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nunit-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to nunit-...@googlegroups.com.
Visit this group at https://groups.google.com/group/nunit-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages