Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Sharing data between tests?

by chromatic (Archbishop)
on Jan 31, 2012 at 21:24 UTC ( [id://951073]=note: print w/replies, xml ) Need Help??


in reply to Sharing data between tests?

I use fixtures with a temporary database (DBICx::TestDatabase). I usually create a module under t/lib/ which performs bulk inserts of the relevant data.

I don't create data in one test and use it in another because that implies an ordering between tests that can be fragile, and works against test parallelism.

If you need more details, let me know; I can post code when I have more time.

Replies are listed 'Best First'.
Re^2: Sharing data between tests?
by ghenry (Vicar) on Jan 31, 2012 at 21:33 UTC

    Thanks. Maybe I should just do the create user in one test and verify it's there and then use a known user in all the other tests.

    They don't have to be ordered, but it would be good to check the freshly created user and do everything the API allows using said user.

    It's things like update their own info, order telephone numbers, send a fax, send an SMS, email to fax, make a call etc. etc.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!
      Maybe I should just do the create user in one test and verify it's there and then use a known user in all the other tests.

      That's what I do. Many of my hardcoded expectations eventually bite me later.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://951073]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-03-29 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found