Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progress indication in unit tests

I have a very long running unit test and I'd like some feedback and progression indication. I've tried using Debug.Writelline(), the corresponding Console and Trace methods, but I can't get output from my test.

Can anyone help? I'm using Visual Studio 2012, xUnit and Resharper. There are many articles on the web about this but none of them solve the problem.

Thanks, M

like image 929
serlingpa Avatar asked Oct 20 '22 22:10

serlingpa


2 Answers

You should break the test down if you can into many smaller tests, unit testing tools are geared up to show the progress of a suite of tests, not show the progress of a single long running test, so they work best with lots of small tests. Its considered bad practice to have long running unit tests as they are generally unmanageable and when they break difficult to work out how to fix.

like image 154
gmn Avatar answered Nov 14 '22 21:11

gmn


xunit.net doesn't support writing output as the test progresses. Instead, the output is batched up, and displayed at the end of each test. This is just the way xunit's API works.

like image 37
citizenmatt Avatar answered Nov 14 '22 23:11

citizenmatt