Re: [nunitv3] RE: Another Question of Naming

"Charlie Poole" <[email protected]> Fri, 12 Sep 2008 11:34:46 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <008901c91506$42c47c50$6401a8c0@ferrari>
Hi Olof, 

It's good to see I'm not the only one who thinks
naming is important. :-)

> So we started with these four names:
> 
> TestCase( object, object, ... )
> TestCases( string )
> Values( object, object, ... )
> DataSource( string )
> 
> .. and now we are here:
> 
> TestCase
> TestCases
> Values
> ParameterSource

Yes... it made sense all alone but when
you line them up, it doesn't.
 
> I liked ValueSource( string ) better than ParameterSource 
> since it clings better to Values, so it is more analogous to 
> the TestCase, TestCases pair.
> 
> But then again the only thing differentiating TestCase and 
> TestCases is singular/plural form.

True

> I guess the hurdle is that the concept of a "named source" is 
> used in both pairs, but the name "Source" only in one. It is 
> a bit inconsequent. Either both should use Source, or none of them:
> 
> 1.
> TestCase
> TestCaseSource
> Values
> ValuesSource> 
> 2.
> TestCase
> TestCases
> Values
> ValuesLookup (or something ..)

#1 is better in my view...

So we can extract some naming principles from this...

1. The inline and named source attributes for each type
should contain a common part like TestCase or Value that
ties them together.

2. The naming pattern of all inline sources together
should be the same. My preference is to use the "bare"
form, as we are doing so far.

3. The naming pattern of all named sources should
be the same, such as adding "Source" to the bare form.

4. Every other source type should work the same way
as we develop them... for example:
     ExcelTestCases versus ExcelValues
     DataBaseTestCaseSource versus DataBaseValueSource
[I'm not actually proposing those names, just illustrating.]

So, back to our immediate problem, I'm ready to go for
a slight modification to your #1:

> TestCase
> TestCaseSource
> Values
> ValueSource

I dropped the plural in Value source, simply because
a "source of values" is a "value source" in English.
I could live with it if others prefer, however.

What do you think?

Charlie

> > Charlie
> >
> >> -----Original Message-----
> >> From: [email protected]
> >> [mailto:[email protected]] On 
> Behalf Of 
> >> Olof Bjarnason
> >> Sent: Tuesday, September 09, 2008 6:32 AM
> >> To: [email protected]
> >> Cc: cliff vaughn; [email protected]
> >> Subject: Re: [nunit-developer] [nunitv3] RE: Another Question of 
> >> Naming
> >>
> >> OK I understand the ValuesAttribute / DataSourceAttribute now.
> >>
> >> And I agree with cliff that Value[s]Source is more readable than 
> >> DataSource:
> >>
> >> Test]
> >> public void AdditionIsCommutative(
> >>        [Values(0, 1, 42, 99)] int a,
> >>        [ValueSource("b-values")]int b) {
> >>        Assert.That( a+b == b+a );
> >> }
> >>
> >>
> >> 2008/9/9 Charlie Poole <[email protected]>:
> >> > Those are possibilities...
> >> >
> >> > Charlie
> >> >
> >> > ________________________________
> >> > From: cliff vaughn [mailto:[email protected]]
> >> > Sent: Monday, September 08, 2008 9:24 PM
> >> > To: Charlie Poole
> >> > Cc: [email protected]; 
> [email protected]
> >> > Subject: Re: [nunit-developer] Another Question of Naming
> >> >
> >> > What about ValueSource or ValuesSource?
> >> >
> >> > On Mon, Sep 8, 2008 at 6:57 PM, Charlie Poole
> >> <[email protected]> wrote:
> >> >>
> >> >> Hi All,
> >> >>
> >> >> I'm still not happy with one of the attribute names we are
> >> using for
> >> >> parameterized tests, so I'm asking for ideas, opinions and
> >> >> suggestions.
> >> >>
> >> >> Here's what we have now...
> >> >>
> >> >> You can specify entire test cases together or individual
> >> values for
> >> >> parameters, which NUnit then combines into test cases
> >> using various
> >> >> strategies.
> >> >>
> >> >> If you go with full test cases, they can either be inline or
> >> >> separately named and referenced...
> >> >>  TestCase( 1.2, 3.0 )   // Inline
> >> >>  TestCases( "myCases")  // Separate
> >> >>
> >> >> Similarly, if you go with individual parameters, they can
> >> be inline
> >> >> or separate...
> >> >>  Values(12, 7, 3)       // Inline
> >> >>  DataSource("myValues") // Separate
> >> >>
> >> >> We'll be adding others - cases in a spreadsheet, etc. -
> >> but these are
> >> >> the four basic ones.
> >> >>
> >> >> I'm quite happy with TestCase, TestCases and Values.
> >> >> I find them quite readable and others have said the same.
> >> >>
> >> >> But DataSource strikes me as a bit too generic. It 
> doesn't tell me
> >> >> that it's a set of single parm values rather than a 
> test case. It
> >> >> sounds like it might have something to do with a DB. But
> >> for the life
> >> >> of me I can't think of anything better.
> >> >>
> >> >> Ideas?
> >> >>
> >> >> Charlie
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> 
> ---------------------------------------------------------------------
> >> >> ---- This SF.Net email is sponsored by the Moblin Your Move
> >> >> Developer's challenge Build the coolest Linux based
> >> applications with
> >> >> Moblin SDK & win great prizes Grand prize is a trip for 
> two to an
> >> >> Open Source event anywhere in the world
> >> >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >> >> _______________________________________________
> >> >> nunit-developer mailing list
> >> >> [email protected]
> >> >> https://lists.sourceforge.net/lists/listinfo/nunit-developer
> >> >
> >> >
> >> >
> >> > --
> >> > thanks
> >> >
> >> > cliff
> >> >
> >> > --~--~---------~--~----~------------~-------~--~----~
> >> > You received this message because you are subscribed to 
> the Google
> >> > Groups "NUnitV3" group.
> >> > To post to this group, send email to [email protected] To
> >> > unsubscribe from this group, send email to
> >> > [email protected]
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/nunitv3?hl=en
> >> > -~----------~----~----~----~------~----~------~--~---
> >> >
> >> >
> >>
> >> --------------------------------------------------------------
> >> -----------
> >> This SF.Net email is sponsored by the Moblin Your Move
> >> Developer's challenge Build the coolest Linux based
> >> applications with Moblin SDK & win great prizes Grand prize
> >> is a trip for two to an Open Source event anywhere in the
> >> world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >> _______________________________________________
> >> nunit-developer mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/nunit-developer
> >>
> >
> >
> >
> 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/