Tuesday, November 29, 2016

NUnit tests are really slow when using Microsoft.Owin.Testing TestServer

After introducing Microsoft.Owin.Testing TestServer in a Test project we noticed that our test execution time increased from a few milliseconds for all tests to multiple seconds for each individual test.

With the help of dotTrace I noticed that most time was spent inside Microsoft.Owin.Hosting.Tracing.DualWriter. This class is used by OWIN to write all OWIN related data to the console.

image

After removing the related tracelistener using the line of code below, I noticed that the test execution time returned back to normal:

Trace.Listeners.Remove("HostingTraceListener");

No comments: