Any call in my unit tests to either Debug.Write(line)
or Console.Write(Line)
simply gets skipped over while debugging and the output is never print
I think it is still actual.
You can use this NuGet package: Bitoxygen.Testing.Pane
Call the custom WriteLine method from this library. It creates a Testing pane inside the Output window and puts messages there always (during each test, it runs independently of DEBUG and TRACE flags).
To make tracing more easy I can recommend to create a base class:
[TestClass]
public abstract class BaseTest
{
#region Properties
public TestContext TestContext { get; set; }
public string Class
{
get { return this.TestContext.FullyQualifiedTestClassName; }
}
public string Method
{
get { return this.TestContext.TestName; }
}
#endregion
#region Methods
protected virtual void Trace(string message)
{
System.Diagnostics.Trace.WriteLine(message);
Output.Testing.Trace.WriteLine(message);
}
#endregion
}
[TestClass]
public class SomeTest : BaseTest
{
[TestMethod]
public void SomeTest1()
{
this.Trace(string.Format("Yeah: {0} and {1}", this.Class, this.Method));
}
}