3 May, 2010
2 Comments
1 category
If you use the default settings of Microsoft Visual Studio 2008/2010 UnitTesting, the Console.WriteLine and Debug.WriteLine won’t be shown. By double clicking the test, you can see the test details, including the standard output and debug output, but I wanted to see the messages directly after a run. This can be done by right clicking de gridview in the Test Results window and adding the columns Output (StdOut) and Debug Trace.
UnitTest class
using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Scripts { [TestClass] public class MainUnitTest { [TestMethod] public void TestMethod1() { string result = string.Empty; result = "This is some debug output"; System.Diagnostics.Debug.WriteLine(result); result = "This is some standard console output"; System.Console.WriteLine(result); } } }
Add columns
Test Result (showing standard console and debug output)
Details View
Tags: Visual Studio
Category: Uncategorized
Hey, thanks for posting this – V.useful!
And what if I have TestMethod1,TestMethod2 and TestMethod3 ?
How can I see *all* the console output *concatenated* for all three methods ? Not separately , but together for all three methods.