[TIP] hackish generative tests (was: Re: Generating tests, II (was: Re: Meta-test methods...))

holger krekel holger at merlinux.eu
Sat May 2 11:39:12 PDT 2009


On Sat, May 02, 2009 at 14:15 -0400, Doug Philips wrote:
> Along time ago (internet time), in a message far far away,
> On or about  Tuesday, April 28, 2009, at 07:17AM, holger krekel indited:
> 
> >However, I think that instrumenting a test run to invoke tests
> >with multiple different parameters or in multiple environments
> >is useful and worthwhile.  
> >
> >So i'd like to phase out (probably making it an 
> >optional plugin) yield-mediated generative tests once 
> >i implemented a mechanism based on 
> >http://codespeak.net/py/trunk/test/funcargs.html 
> >that allows to invoke a test function repeatedly 
> 
> funcargs is quite interesting.
> Are you saying that funcargs (as described at that link) already does repeated invocation? I'm a bit confused since nothing I read there talks about that (or somehow I've missed it).
> 
> It seems that funcargs is filling a niche (separation of configuration from testing) in a way different from setUp and tearDown.
> Or maybe funcargs is destined to replace/eliminate setUp and tearDown?

that's the ultimate goal.  there are some use cases,
however, that still make using setup/teadown more useful. 
When it comes to parametrizing Test methods with different
app classes, subclassing a base set of tests and
overriding/configuring things in a setup/teardown is
currently more straightforward than using funcargs. 

> The way it is described, funcargs seems a quite clean way to provide additional parameters to test methods.
> Running a test method many times with "variations on a theme" seems to be orthogonal.

Yes, exactly. Given such an additional mechanism that re-runs the same test 
method with multiple different values for the same funcarg would
provide this "variations on a them".  This issue 

    http://bitbucket.org/hpk42/py-trunk/issue/2/next-generation-generative-tests

is the result of a discussion with Samuele Pedroni who wants
to run tests with multiple different browsers and is currently
using the yield-way.  The issue contains a code sketch
how a plugin could trigger the running of the same test
function with multiple browsers via funcargs. 

> Interested in hearing more...

interested to hear if this makes sense to you.
thanks for your feedback & cheers,
holger ... hurrying back to read the last enthralling part of a book ... 

> -Doug
> 
> 
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
> 

-- 
Metaprogramming, Python, Testing: http://tetamap.wordpress.com
Python, PyPy, pytest contracting: http://merlinux.eu 



More information about the testing-in-python mailing list