Re: Updates to NUnit 2.5
"Charlie Poole" <[email protected]> Fri, 4 Jul 2008 14:38:40 -0700
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <000601c8de1e$548003c0$6401a8c0@ferrari> |
It's not (entirely) automagical. If you don't specify where the arguments are to be found, then they must be provided by one or more members of the same class, annotated with TestCaseFactoryAttribute( Type, Type... ) where the types match the required types of the method. Whether this is a normal use case is probably a matter of style. Some folks may want to specify all their test case factories by name, others may want NUnit to find them. Personally, I have only used this in order to test it. :-) FWIW, I should mention that this is an approach that is familiar to mbUnit users, although the use of an array of types to characterize a factory is new to NUnit. Charlie > -----Original Message----- > From: Olof Bjarnason [mailto:[email protected]] > Sent: Friday, July 04, 2008 2:05 PM > To: [email protected] > Cc: Charlie Poole > Subject: Re: [nunit-developer] Updates to NUnit 2.5 > > Is "Factory without arguments" a ubique use case or an > esoteric one? I for one would like to clearly state were my > Test Case data came from (the Source) > > I always think twice before making things "automagical" ... > > 2008/7/4 Charlie Poole <[email protected]>: > > Sounds like a good possibility, although it seems to share with > > "Factory" the deficiency of not making much sense when used without > > arguments. > > > > Maybe I should leave the attribute off in that case... > > > > What if > > [Test] > > public void Method(int x, int y) { ... } automatically > searched for a > > factory within the class? > > > > Would that lead to confusion? > > > > Charlie > > > >> -----Original Message----- > >> From: [email protected] > >> [mailto:[email protected]] On > Behalf Of > >> Olof Bjarnason > >> Sent: Friday, July 04, 2008 1:27 PM > >> To: Charlie Poole > >> Cc: [email protected] > >> Subject: Re: [nunit-developer] Updates to NUnit 2.5 > >> > >> What about "Source"? Or maybe that's already taken? > >> > >> 2008/7/4 Charlie Poole <[email protected]>: > >> > I just updated the online documentation to match what's in CVS. > >> > See for example: > >> > http://nunit.org/?p=testCase&r=2.5 > >> > http://nunit.org/?p=factory&r=2.5 > >> > http://nunit.org/?p=testCaseFactory&r=2.5 > >> > > >> > I'm still looking for suggestions regarding renaming > >> FactoryAttribute. > >> > > >> > Charlie > >> > > >> >> -----Original Message----- > >> >> From: [email protected] > >> >> [mailto:[email protected]] On > >> Behalf Of > >> >> Charlie Poole > >> >> Sent: Thursday, July 03, 2008 7:27 PM > >> >> To: [email protected] > >> >> Subject: Re: [nunit-developer] Updates to NUnit 2.5 > >> >> > >> >> Hi All, > >> >> > >> >> Latest checkin finishes work on TestCaseFactories, which > >> are methods, > >> >> properties or fields that provide test cases to a > >> parameterized test. > >> >> There's one outstanding question I could use some ideas on > >> - see the > >> >> end of this note. > >> >> > >> >> TestCaseFactoryAttribute is an optional attribute that can > >> be used to > >> >> mark these factories. If used, it should specify the > types of the > >> >> arguments provided... e.g.: > >> >> [TestCaseFactory(typeof(int), typeof(int), typeof(string))] > >> >> > >> >> FactoryAttribute is used on the parameterized test itself > >> and has the > >> >> following forms: > >> >> [Factory] > >> >> [Factory(Type factoryType)] > >> >> [Factory(string factoryNames)] > >> >> [Factory(Type factoryType, string factoryNames)] > >> >> > >> >> factoryType is the type of the object that holds the factory, > >> >> defaulting to the same class as the test. > >> >> > >> >> factoryName is the name of the method, property or field > >> that serves > >> >> as a factory - or several names separated by commas. > >> >> It defaults to "find all compatible test factories in the type". > >> >> > >> >> If you are looking for compatible test factories, > that's when you > >> >> need to mark them with the TestCaseFactoryAttribute. > >> >> Compatible means that the types match the argumets of the > >> test method. > >> >> > >> >> Here's the question: I'm still not happy with "Factory" to > >> identify > >> >> indicate that factories should be used, especially the > >> form without > >> >> any arguments. MbUnit uses "UsesFactories" > >> >> for a similar situation, so that might work. Any ideas? > >> >> Note that we will want to use the same attribute on individual > >> >> arguments as well as on methods. > >> >> > >> >> Charlie > >> >> > >> >> > >> >> > >> >> -------------------------------------------------------------- > >> >> ----------- > >> >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > >> >> Studies have shown that voting for your favorite open > >> source project, > >> >> along with a healthy diet, reduces your potential for chronic > >> >> lameness and boredom. Vote Now at > >> >> http://www.sourceforge.net/community/cca08 > >> >> _______________________________________________ > >> >> nunit-developer mailing list > >> >> [email protected] > >> >> https://lists.sourceforge.net/lists/listinfo/nunit-developer > >> >> > >> > > >> > > >> > > >> > > >> > --------------------------------------------------------------------- > >> - > >> > --- Sponsored by: SourceForge.net Community Choice > Awards: VOTE NOW! > >> > Studies have shown that voting for your favorite open > >> source project, > >> > along with a healthy diet, reduces your potential for > >> chronic lameness > >> > and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > >> > _______________________________________________ > >> > nunit-developer mailing list > >> > [email protected] > >> > https://lists.sourceforge.net/lists/listinfo/nunit-developer > >> > > >> > >> -------------------------------------------------------------- > >> ----------- > >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > >> Studies have shown that voting for your favorite open > source project, > >> along with a healthy diet, reduces your potential for chronic > >> lameness and boredom. Vote Now at > >> http://www.sourceforge.net/community/cca08 > >> _______________________________________________ > >> nunit-developer mailing list > >> [email protected] > >> https://lists.sourceforge.net/lists/listinfo/nunit-developer > >> > > > > > > > > > ---------------------------------------------------------------------- > > --- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > > Studies have shown that voting for your favorite open > source project, > > along with a healthy diet, reduces your potential for > chronic lameness > > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > > _______________________________________________ > > nunit-developer mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/nunit-developer > > > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08