logo       

NUnit Extensability: msg#00039

windows.dotnet.nunit.devel

Subject: NUnit Extensability

Hi folks,

I've recently been experimenting with NUnit's extensibility model. My
challenge has been to emulate VSTS Unit Testing as fully as possible.

So far I have only hit a single roadblock. This was when it came it
implement support for [AssemblyInitialize] and [AssemblyCleanup].
NUnit already supports TestFixture and TestCase extensibility. There
is however no easy way to augment or replace a TestAssembly suite.
This would be nessesary in order to override the DoFixtureSetUp/
DoFixtureTearDown methods and have them call
[AssemblyInitialize]/[AssemblyCleanup]

I have tried a few different modifications (of nunit.core) to allow
this extensibility.

1) Extended TestSuite to include FixtureSetUp/FixtureTearDown events.

I found that implementing [AssemblyInitialize] and [AssemblyCleanup]
using events created code that felt complex and fragile. The existing
TestSuite code is easy work with. I wouldn't want to compramise this
simplicity by adding events.

2) Extend the ISuiteBuilder interface to include "bool
CanBuildFrom(Assembly)" and "TestSuite BuildFrom(Assembly)".

At the moment ISuiteBuilder is a simple interface with only two
methods. There are already many implementations of ISuiteBuilder.
Extending this interface would force all of these implementations to
accommodate two new methods the majority don't care about. It would
also be extra complexity and decisions for future implementers to deal
with.

3) Allow types marked with [SuiteBuilder] to implement a new
IAssemblySuiteBuilder interface.

By allowing [SuiteBuilder] types to implement an optional
IAssemblySuiteBuilder interface there would be no effect on existing
implementations. The suite builders that care about creating a custom
TestAssembly could implement this interface as well as ISuiteBuilder.

Are there any other ways of implementing this functionality that I
have overlooked?

Thanks, Jamie.

..
http://www.testdriven.net
http://weblogs.asp.net/nunitaddin


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise