Pluggable TestRunners

I've been moving towards a more extensible test runner framework. My first implementation using the new framework is support for junit. I was pleased to find that the 'junit.framework' assembly compiles out of the box with the J# compiler. I have made one minor tweak to it though. .NET behaves slightly different to Java when throwing exceptions. Java fills in the stack trace when an exception is created, whereas .NET does when it's thrown. I've modified junit so it stores the exception without rethrowing it. This preserves the useful stack trace information when a test fails.

Hopefully this will prove useful to people porting large Java projects to .NET. It will mean unit testing can start strait away, without the need to modify all tests to use NUnit attributes. This will be especially useful for projects that must compile and be tested on both platforms.

Here is a screenshot of junit running inside Visual Studio.NET...

There is a 'New Project...' wizard for generating junit projects.  The 'junit.framework' assembly will be included in the project.  All test project templates are also available for editing vier the Start menu.

I'm definately going to add support for Ad Hoc tests (more soon).  Are there any other test frameworks I should consider?  #Unit is the one that springs to mind.  Is anyone using this?  I wasn't able to find much information on it.

1 Comment

  • I tried installing the latest version, but since I don't have J# installed, I didn't get anywhere. I don't want J# installed, since I'm never going to use it. Please fix the addin's install so it will still work when J# isn't installed!

Comments have been disabled for this content.