Creating many tests from a single method?

25 views
Skip to first unread message

Kieron

unread,
Aug 21, 2012, 10:58:22 AM8/21/12
to nunit-...@googlegroups.com
Hi,

Is there an extension point that acts in a similar way to the parameterised test case provider?

I'd like to be able to run the same tests many times (still taking into account any test cases used), the reason behind this requirement is an infrastructure type add-in that provides additional information via a base class. I've currently got this working by using separate classes which inherit from a my test fixture. Based on the namespace, I can make the decision about what information to create in the setup, and then tear down.

It would be a better solution, if I could avoid having to create many super classes, and instead provide the methods via some kind of builder - so, one method could appear and execute many times.

Does anyone have any advice? - Is this even possible?

Thanks,
Kieron

Charlie Poole

unread,
Aug 21, 2012, 1:24:02 PM8/21/12
to nunit-...@googlegroups.com
Hi Kieron,
Using the extension point above, you would have to figure out some way
to create the info needed and pass it to the test method. A custom attribute
is the most obvious approach to specifying the info. To get it to the method,
passing it as an argument would be the simplest but would require all the test
methods to be written to take such an argument.

One thought would be to create a data structure to use as an argument
and only return true to HasTestCasesFor when the method has that structure
as an argument.

Charlie

> Does anyone have any advice? - Is this even possible?
>
> Thanks,
> Kieron
>
> --
> You received this message because you are subscribed to the Google Groups
> "NUnit-Discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nunit-discuss/-/1bgqmSHop1sJ.
> To post to this group, send email to nunit-...@googlegroups.com.
> To unsubscribe from this group, send email to
> nunit-discus...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/nunit-discuss?hl=en.
Reply all
Reply to author
Forward
0 new messages