Discussion:
nunit-developer Digest, Vol 23, Issue 21
Gary Evans
2008-04-26 09:48:32 UTC
Permalink
Hi Charlie
The extension points are listed in the nunitAddins page, which you can> navigate> to by selecting Other Features | Extensibility | NUnit Addins.> > My guess is that your extension should probably be both a test case builder> and a data provider, so take a look at the ParameterProviders extension> point.> > CharlieI've upgraded my theory extension to build and work against the NUnit 2.5 changes, but I haven't made use of any ParameterProvider stuff yet - what advantage does it give me to do so?
For my data-driven tests and fixtures, I can see that using the ParamterProvider lets me re-use code (I can lose my DynamicTestMethod which derives from NUnitTestMethod), but for my theory extension, I need to create a new TestMethod anyway - not just for the parameters, so it is worth me going to the efforts of using a parameter provider?

Will it give me anything different - it this the way where we'd get the user's test method invoked for all data sets but only display one entry in the tree? (and they'd be able to drill down to see all of the data used in running the test/theory?)

Cheers,

Gary
_________________________________________________________________
Bag extra points with the Walkers Brit Trip Game
http://www.walkersbrittrips.co.uk/game
Charlie Poole
2008-04-26 17:26:14 UTC
Permalink
Hi Gary,
My guess is that your extension should probably be both a test case
builder
and a data provider, so take a look at the ParameterProviders extension
point.
I've upgraded my theory extension to build and work against the NUnit 2.5
changes, but I haven't made use of any ParameterProvider stuff yet - what
advantage does it give me to do so?

To be more precise: I meant that the InlineData and PropertyData be handled
by providers, rather than directly in your code. This has
advantages and disadvantages, which probably apply differently to each of
your extensions

PRO
You can reuse code, since NUnitTestMethod now understands providers.
Your extensions can make use of other data providers, if those providers are
willing to give you data.
(Another way to say this is that people can decide to write data
extensions for your provider.)
Other extensions can make use of your data providers, if you allow it.
(So someone could create a new extension from your building blocks)

CON
In 2.5, if you accept any data providers, you have no further control over
which providers supply it.

For my data-driven tests and fixtures, I can see that using the
ParamterProvider lets me re-use code (I can lose my DynamicTestMethod which
derives from NUnitTestMethod), but for my theory extension, I need to create
a new TestMethod anyway - not just for the parameters, so it is worth me
going to the efforts of using a parameter provider?

I see the difference. You would have to figure out how much your new method
differs from a standard method. For example,
you may only need to override the method that translates an exception to a
result state.

Will it give me anything different - it this the way where we'd get the
user's test method invoked for all data sets but only display one entry in
the tree? (and they'd be able to drill down to see all of the data used in
running the test/theory?)

What is currently called ParameterProviders (a better name may be
TestCaseProviders) is an extension point for creating new parameterized
tests in the tree itself. I plan to add another extension point that
provides data at runtime, without creating any
new data in the tree. This would only work for a new type of test case that
returned multiple results and would require support in
the UI in order to drill down into the results. I feel that's still the
biggest thing missing for the final 2.5 release.

I just downloaded the latest versions of both extensions. I'll post any
further comments as I go through them.

Charlie

Cheers,

Gary


_____

Get fish-slapping on Messenger Play Now
<http://mobile.uk.msn.com/pc/messenger.aspx>

Loading...