Timur Lemeshko
Timur Lemeshko

Reputation: 2879

Write to tests result window in .net Core tests

I'm writing unit tests in .net core.

I want to write some additional data to tests result window for information.

How can i do this?

Upvotes: 4

Views: 1224

Answers (1)

daw
daw

Reputation: 2049

Downvoters probably don't understand that as of May 2017, all output (trace and console) is swallowed by visual studio and there is no "test output" link shown in the test runner like non .net core projects.

1) The first workaround I used was to create a log utility that writes to a file and just keep that file open in Visual Studio.

2) A simpler route is that if you choose "debug unit test" instead of "run unit test" then debug trace output WILL appear in the output window.

using System.Diagnostics;

Debug.WriteLine("Hi Timur");

I'd also suggest going to tool->options->debugging->debug window and switching off module loading messages to remove all the extra framework messages so your logs are easier to read.

Upvotes: 4

Related Questions