Nunit-console: How to get ouput in code showing up with console app

Created on 19 Jan 2017  路  3Comments  路  Source: nunit/nunit-console

I am using the console app NUnit3-console version 3.6. I am trying to get some debug output I have in code such as System.Diagnostics.Debug.WriteLine("foo") print somewhere, whether it be in the TestResult.xml or the shell window.

The command line options documentation does not provide any hints.

Thanks in advance!

done question

Most helpful comment

I see that @NickyWeber was asking expressly about Debug output. Output from Debug.WriteLine goes to an attached debugger. If no debugger is attached, then it isn't displayed. The simplest way to see the debug output is to run the console under the debugger, in Visual Studio for example.

If you want to see certain output when you are __not__ debugging the tests, then you need to use one of the other methods suggested by @ChrisMaddock

All 3 comments

You're looking for the TestContext class - that gives you various options depending on whether you want to write to the window of results xml.

https://github.com/nunit/docs/wiki/TestContext

I'll close this issue as needing no further action - but please comment more if you have more problems - the team will still be notified.

I see that @NickyWeber was asking expressly about Debug output. Output from Debug.WriteLine goes to an attached debugger. If no debugger is attached, then it isn't displayed. The simplest way to see the debug output is to run the console under the debugger, in Visual Studio for example.

If you want to see certain output when you are __not__ debugging the tests, then you need to use one of the other methods suggested by @ChrisMaddock

Thanks alot!

Was this page helpful?
0 / 5 - 0 ratings