10

Closed

AutoFixture.NUnit?

description

I'm not even sure this makes any sense, but assuming that NUnit supports similar functionality/concepts as those in AutoFixture.xUnit.net, would it make sense to create an NUnit port of that project?
(for those of us who might like to put that approach to use, but are tied to NUnit)
Closed Oct 12, 2013 at 2:04 PM by baxevanis
Resolved in AutoFixture 3.9.0.

comments

ploeh wrote Apr 30, 2011 at 8:07 AM

Yes, under that assumptions it would make tons of sense :)

I haven't used NUnit in many years, so I don't know if it currently has support for extensible parameterized tests. If it does, it's probably going to be possible to do something similar as we did with AutoFixture.Xunit. Can you point me in the right direction regarding NUnit?

jrnail23 wrote May 2, 2011 at 7:34 PM

I'll take a look and see how similar their features are. NUnit 2.5 defnitely has Theory/datapoint and parameterized tests, but I'm not sure how similar they actually are.
I'll let you know what I find out.

jrnail23 wrote May 17, 2011 at 5:30 PM

Mark, I looked at NUnit briefly, and it looks like their implementation of data attributes takes a significantly different approach than that of xUnit. Whereas xUnit's attributes have behavior (i.e. GetData) in them to support pulling the data from the attribute itself, NUnit seems to use its attributes as more of an empty marker so that a test case data provider can extract data from a method or type based on its own algorithm. The test case data provider seems to be extensible via some sort of add-in mechanism, so it's probably possible, but would definitely require more in-depth investigation.

ploeh wrote May 19, 2011 at 3:48 PM

Yes, that sounds reasonable. FWIW I actually consider attributes without behavior a more correct design approach than 'active' attributes.

jwJung wrote Dec 23, 2011 at 1:33 PM

From NUnit 2.6(Beta), Action attributes was introduced. (http://www.nunit.org/index.php?p=actionAttributes&r=2.6) I think this would be the goal to fix this issue. Before 2.6 version, I know we cannot get MethodInfo from TestCaseAttribute like TeoryAttribute of xUnit.

jwJung wrote Dec 23, 2011 at 4:57 PM

With Action attributes from NUnit 2.6(Beta), I thought that it can be fixed but couldn't in my case, but I would like to show other workaround. Please see, http://autofixture.codeplex.com/discussions/284043

gertjvr wrote Aug 30, 2013 at 12:32 AM

I have extended NUnit with AutoTestCaseAttribute that will use AutoFixture to generate arguments for the parameterised unit tests.

Read about how to extent NUnit at http://gertjvr.wordpress.com/