Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I view Console Output whilst my Unit Tests are running in Visual Studio 2008?

How can I view Console Output whilst my Unit Tests are running? I'm using the Visual Studio 2008 unit testing framework. So I know that after a test is finished I can go to the results page for the test and click on output, however I'm after a way that I can effectively watch the console output for tests as the unit tests are executed.

EDIT - Interested in a specific answer for VS out of the box (i.e. without having to buy a plugin)

like image 617
Greg Avatar asked Oct 14 '22 12:10

Greg


1 Answers

You can use

System.Diagnostics.Debug.WriteLine("Message");

To output to the "Output" tab while the unit test is running.

If you are using Console.Out.WriteLine("Message") then this will only show up at the end of the test run, as you mentioned.

I have used the following to give me both runtime messages and the end of test result output:

private void TestTrace(string message)
{
    System.Diagnostics.Debug.WriteLine(message);
    Console.Out.WriteLine(message);
}
like image 148
dodgy_coder Avatar answered Oct 18 '22 14:10

dodgy_coder