[TIP] Using randomic tests

Geoff Bache geoff.bache at gmail.com
Tue Nov 16 02:40:10 PST 2010


Hi Yoni, Aviv,

Following that link, it seemed like that plugin randomized the order
of the tests rather than actually setting random seeds for the tests.

I'm currently working on something that might be of use to you when
I've released it (hopefully by Christmas!). It's called "capturemock"
and the idea is to capture the interaction with particular modules or
functions with the intention of replaying them later
to do the same things as they did originally.

In this case you'd just set it up to capture the interaction with the
"random" module, and when a bug was found, run it against that
particular interaction.

The functionality already exists and has been used a fair amount, the
thing is it's currently intimately wired into my TextTest tool and I'm
trying to extract it so it can be used alone. More details and a bit
of background can be found at

http://www.texttest.org/index.php?page=documentation_trunk&n=faking_it_with_texttest#collect_traffic_python

Regards,
Geoff

On Tue, Nov 16, 2010 at 9:59 AM, Aviv Ben-Yosef <aviv.by at gmail.com> wrote:
> Hey Yoni,
> I don't know any main-stream plugin that does what you ask for, but I'd
> advise you to follow this issue in nose's
> site: http://code.google.com/p/python-nose/issues/detail?id=255
> It contains a patch that does what you want and more, and might be a bit
> alive (last post a few weeks ago).
> Cheers,
>
> On Mon, Nov 15, 2010 at 18:20, Yoni Tsafir <yonix85 at gmail.com> wrote:
>>
>> Hi there,
>> I like writing tests that use a lot of random values as input.
>> Something I found useful during my experience in other languages, is to
>> have some kind of test runner that prints the initial random seed when a
>> test fails, and lets you run your tests with the same random seed again so
>> you can debug it and tell why the test failed with this particular seed.
>> This of course forces your tests to use a the singleton instance of random
>> instead of instantiating new classes of "random.Random" (or maybe use
>> another singleton random object).
>> Now, before I start writing this mechanism in python as well, I was
>> wondering if there is anything already implemented in this area (maybe some
>> kind of nose's hidden feature or something), or any other suggestions of
>> ways to achieve what I'm seeking after.
>> Thanks!
>> Yoni.
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
>>
>
>
>
> --
> Aviv Ben-Yosef
> Miracle Max: You rush a miracle man, you get rotten miracles.
> @avivby http://codelord.net
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>
>



More information about the testing-in-python mailing list