Re: Updates to NUnit 2.5

"Charlie Poole" <[email protected]> Wed, 25 Jun 2008 09:24:40 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <001301c8d6df$f9504ea0$6401a8c0@ferrari>
Hi Cliff,

Well, I never thought I'd agree that VB is elegant, but
I guess so. :-)

Essentially, VB let's you specify a different name for the
method. In C#, you do have a choice. You an implement the
interface explicitly, as in your example, or as a public
method. Only with the explicit interface do you have to
make a conversion to the interface type.

However, this is moot here, as you don't know the actual
type when you get the interface. In fact, the internal
NUnit implementation combines the IEnumerables from
multiple providers of different types.

Given the low-volume usage of this interface (implemented 
by provider extensions, consumed by NUnit by builder extensions)
it probably doesn't matter a lot what we call it. Interfaces 
like HandleException, which is implemented by user tests,
deserve more attention with regard to naming.

That said, it's still open for changing. Any other voices
on this?

Charlie

> -----Original Message-----
> From: Vaughn, Clifton [mailto:[email protected]] 
> Sent: Wednesday, June 25, 2008 9:09 AM
> To: Charlie Poole; [email protected]
> Subject: RE: [nunit-developer] Updates to NUnit 2.5
> 
> VB handles this issue a bit more elegantly than C#.  In VB, 
> you can do the following:
> 
> Public function GetTestCases() as Ienumerable Handles
> ITestCaseProvider.Get()
> 
> End function
> 
> In C#, you have to explicitly use the interface and lose 
> public accessibility like so:
> 
> Ienumerable ITestCaseProvider.Get()
> {}
> 
> Now in order to use the C# version, you'd have to convert 
> your instance variable to ITestCaseProvider.  A bit of 
> nuisance, but usable.
> 
> Thanks
> 
> cliff
>  
> 
> > -----Original Message-----
> > From: Charlie Poole [mailto:[email protected]]
> > Sent: Wednesday, June 25, 2008 11:00 AM
> > To: Vaughn, Clifton; [email protected]
> > Subject: RE: [nunit-developer] Updates to NUnit 2.5
> > 
> > Bearing in mind that a class can implement all sorts of interfaces, 
> > I'm hesitant to use short names as a matter of practice.
> > 
> > What do others think?
> > 
> > Charlie
> > 
> > > -----Original Message-----
> > > From: Vaughn, Clifton [mailto:[email protected]]
> > > Sent: Wednesday, June 25, 2008 7:37 AM
> > > To: Charlie Poole; [email protected]
> > > Subject: RE: [nunit-developer] Updates to NUnit 2.5
> > > 
> > > Fair enough point and I considered that, but I think if 
> you look at 
> > > the line in its full context:
> > > 
> > > testCases = provider.Get(someMethod);
> > > 
> > > then it would seem to provide the extra information you want. 
> > >  A time when this would be a problem is when you have one class 
> > > implementing more than one interface with the simple
> > > Get() signature, but that doesn't matter since you said 
> there's no 
> > > IParameterProvider.
> > > 
> > > Thanks
> > > 
> > > cliff
> > >  
> > > 
> > > > -----Original Message-----
> > > > From: Charlie Poole [mailto:[email protected]]
> > > > Sent: Tuesday, June 24, 2008 8:35 PM
> > > > To: Vaughn, Clifton; [email protected]
> > > > Subject: RE: [nunit-developer] Updates to NUnit 2.5
> > > > 
> > > > Hi Cliff,
> > > > 
> > > > > Any reason the signature of the method could be changed.  
> > > > > Something like the following:
> > > > > 
> > > > > > >     public interface ITestCaseProvider
> > > > > > >     {
> > > > > > >         bool Exists(MethodInfo method);
> > > > > > >         IEnumerable Get(MethodInfo method);
> > > > > > >     }
> > > > >
> > > > > The same would be true for IParameterProvider also.  IMO,
> > > it seems
> > > > > redundant to include the type in the method name.
> > > > 
> > > > There's no type in the method name, but I see what you mean...
> > > > TestCase appears in the name of the interface and the name
> > > of the each
> > > > method. That's redundant in the declaration, although not
> > > necessarily
> > > > in using the interface.
> > > > 
> > > > When I write
> > > > 	provider.GetTestCasesFor(someMethod)
> > > > it makes sense to me. But
> > > > 	provider.Get(someMethod)
> > > > gives me pause - what am I getting.
> > > > 
> > > > In the end, this may just be a matter of style. I'm 
> open to more 
> > > > suggestions, but I think the verbs need objects to make
> > sense here.
> > > > 
> > > > There's no longer a IParameterProvider, ITestCaseProvider
> > > replaces it.
> > > > 
> > > > Charlie
> > > > 
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > cliff
> > > > >  
> > > > > 
> > > > > > -----Original Message-----
> > > > > > From: [email protected]
> > > > > > [mailto:[email protected]] On
> > > > Behalf Of
> > > > > > Charlie Poole
> > > > > > Sent: Tuesday, June 24, 2008 5:00 PM
> > > > > > To: [email protected]
> > > > > > Subject: Re: [nunit-developer] Updates to NUnit 2.5
> > > > > > 
> > > > > > More updates for those following CVS - note that the
> > > > > attached emails
> > > > > > cover all the important changes since the Alpha 2 release,
> > > > > and will be
> > > > > > reflected in the next Alpha in a few weeks.
> > > > > > 
> > > > > > There is a major change to the Test hierarchy: TestCase
> > > > > doesn't exist
> > > > > > any longer. TestMethod inherits directly from Test now and
> > > > > represents
> > > > > > a Test implemented by a method. There could be some further
> > > > > changes in
> > > > > > this branch as well as for TestSuite, TestFixture, etc.
> > > > > > 
> > > > > > All this is part of the move to parameterized tests, which
> > > > > blurs the
> > > > > > distinction between a suite and a case. I'm currently
> > > using "test
> > > > > > case" to refer to a single execution of a test with
> > one set of
> > > > > > parameters, producing one result and the class names will
> > > > begin to
> > > > > > reflect that.
> > > > > > 
> > > > > > NUnitTestCaseBuilder is now split in two, with the
> > > > original builder
> > > > > > handling "regular" tests and ParameterizedTestCaseBuilder
> > > > handling
> > > > > > parameterized tests. A new DynamicTestBuilder, which
> > recognizes
> > > > > > DynamicTestAttribute and creates DynamicTests is
> > > > > > 
> > > > > > Charlie
> > > > > > 
> > > > > > > -----Original Message-----
> > > > > > > From: [email protected]
> > > > > > > [mailto:[email protected]] On
> > > > > Behalf Of
> > > > > > > Charlie Poole
> > > > > > > Sent: Sunday, June 22, 2008 9:29 AM
> > > > > > > To: [email protected]
> > > > > > > Subject: Re: [nunit-developer] Updates to NUnit 2.5
> > > > > > > 
> > > > > > > More updates checked into CVS. All of this will be
> > > > > > documented for the
> > > > > > > release, but some of you may want an early heads-up,
> > > > > > especially if you
> > > > > > > are working on addins.
> > > > > > > 
> > > > > > > EXTENSIBILITY
> > > > > > > 
> > > > > > > The ParameterProviders extension point has been 
> renamed to 
> > > > > > > TestCaseProviders. The interface that extensions must
> > > > > > implement is now
> > > > > > > ITestCaseProvider. Here's the definition:
> > > > > > > 
> > > > > > >     public interface ITestCaseProvider
> > > > > > >     {
> > > > > > >         bool HasTestCasesFor(MethodInfo method);
> > > > > > >         IEnumerable GetTestCasesFor(MethodInfo method);
> > > > > > >     }
> > > > > > > 
> > > > > > > This is essentially the same as the IParameterProvider
> > > > > interface in
> > > > > > > the first two alphas.
> > > > > > > 
> > > > > > > BUILT-IN PARAMETERIZED TESTS
> > > > > > > 
> > > > > > > NUnit currently has two built-in providers:
> > > > > > > TestCaseParameterProvider for TestCaseAttribute and 
> > > > > > > TestCaseFactoryProvider for FactoryAttribute.
> > > > > > > 
> > > > > > > TestCaseParameterProvider will perform a number of
> > > > conversions in
> > > > > > > order to make the provided argument compatible with
> > > method call.
> > > > > > > 
> > > > > > > TestCaseFactoryProvider can work with properties, methods
> > > > > > and fields
> > > > > > > that implement IEnumerable. For static cases, use of an
> > > > > > array is the
> > > > > > > simplest approach. Either static or instance 
> members may be
> > > > > > used. For
> > > > > > > methods takin a single ValueType argument, the enumerator
> > > > > > may return
> > > > > > > the bare argument rather than an array with one member.
> > > > > > > 
> > > > > > > All of the above work at load time. For dynamic 
> test cases,
> > > > > > provided
> > > > > > > at the instance of executin the test and possibly varying
> > > > > > from run to
> > > > > > > run, I plan to add DynamicTest and 
> DynamicTestCaseProvider.
> > > > > > > 
> > > > > > > OTHER STUFF
> > > > > > > 
> > > > > > > The RequiredAddinAttribute may be placed on the assembly,
> > > > > > on a class
> > > > > > > or on a method. If the named addin is not loaded, the test
> > > > > > or suite is
> > > > > > > NotRunnable and shows up as red in the Gui.
> > > > > > > 
> > > > > > > Charlie
> > > > > > > 
> > > > > > > > -----Original Message-----
> > > > > > > > From: [email protected]
> > > > > > > > 
> [mailto:[email protected]] On
> > > > > > Behalf Of
> > > > > > > > Charlie Poole
> > > > > > > > Sent: Monday, June 16, 2008 12:14 PM
> > > > > > > > To: [email protected]
> > > > > > > > Subject: [nunit-developer] Updates to NUnit 2.5
> > > > > > > > 
> > > > > > > > Hi All,
> > > > > > > > 
> > > > > > > > Now that I'm back home, I can properly upload a 
> number of
> > > > > > changes I
> > > > > > > > made on my laptop while travelling.
> > > > > > > > 
> > > > > > > > So far, I have made the following changes:
> > > > > > > > 
> > > > > > > > 1. The release is now 2.5 Alpha 3.
> > > > > > > > 
> > > > > > > > 2. I have changed DataSourceAttribute to 
> FactoryAttribute
> > > > > > > and it may
> > > > > > > > now appear on a property, field or method. Any of
> > these may
> > > > > > > be either
> > > > > > > > static or instance members.
> > > > > > > > 
> > > > > > > > 3. 
> IParameterProvider.GetParametersFor(MethodInfo method)
> > > > > > > now returns
> > > > > > > > IEnumerable rather than IList.
> > > > > > > > 
> > > > > > > > 4. The Test abstract class now has default 
> implementations
> > > > > > > for several
> > > > > > > > properties that were previously abstract. One of the
> > > > > > > > Run() overloads has been removed.
> > > > > > > > 
> > > > > > > > I'll post further as more changes are made.
> > > > > > > > 
> > > > > > > > Charlie
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > --------------------------------------------------------------
> > > > > > > > -----------
> > > > > > > > Check out the new SourceForge.net Marketplace.
> > > > > > > > It's the best place to buy or sell services for just
> > > > > > about anything
> > > > > > > > Open Source.
> > > > > > > > http://sourceforge.net/services/buy/index.php
> > > > > > > > _______________________________________________
> > > > > > > > nunit-developer mailing list 
> > > > > > > > [email protected]
> > > > > > > > 
> > https://lists.sourceforge.net/lists/listinfo/nunit-developer
> > > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > --------------------------------------------------------------
> > > > > > > -----------
> > > > > > > Check out the new SourceForge.net Marketplace.
> > > > > > > It's the best place to buy or sell services for just
> > > > > about anything
> > > > > > > Open Source.
> > > > > > > http://sourceforge.net/services/buy/index.php
> > > > > > > _______________________________________________
> > > > > > > nunit-developer mailing list 
> > > > > > > [email protected]
> > > > > > > 
> https://lists.sourceforge.net/lists/listinfo/nunit-developer
> > > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> --------------------------------------------------------------
> > > > > > -----------
> > > > > > Check out the new SourceForge.net Marketplace.
> > > > > > It's the best place to buy or sell services for just
> > > > about anything
> > > > > > Open Source.
> > > > > > http://sourceforge.net/services/buy/index.php
> > > > > > _______________________________________________
> > > > > > nunit-developer mailing list
> > > > > > [email protected]
> > > > > > https://lists.sourceforge.net/lists/listinfo/nunit-developer
> > > > > > 
> > > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > 
> > 
> > 
> 



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php