1

I have a lot of unit tests in c#. Now I want nunit to log the following when it runs: - Time when a test starts/Finish. - Result of the test. - Name of the test.

For example:

[2/10/2014 16:11:00] TestA STARTED
[2/10/2014 16:12:00] TestA OK
[2/10/2014 16:13:00] TestB STARTED
[2/10/2014 16:14:00] TestB FAILED: exception.

I don't want to go to every single test to make it happen because I have a lot of unit tests over the years. Is there any way that you know of can make it easy for me to do so?

Really appreciate your help.

  • I'm not certain I understand. You're in control of what you log, what you don't, and how helpful the log is for you. What is it you want us to help with? Have you tried to do anything? – PiousVenom Apr 03 '14 at 21:27
  • I've been trying to do some research in nunit addins but I'm not sure if I was on the right direction or is there any better way to log. I need help from any of you guys who have made your own custom log to point me in a direction that worked for you. – Khanh Nguyen Apr 03 '14 at 21:36

1 Answers1

1

I started writing an answer advising you to use Setup and Teardown but got to thinking you'd have issues trying to display the result. Turns out you'll have to use an NUnit EventListener

@Izzy posted some example code in his similar question here

Community
  • 1
  • 1
McAden
  • 13,714
  • 5
  • 37
  • 63