Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Sharing data between tests?

by Util (Priest)
on Jan 31, 2012 at 21:31 UTC ( #951075=note: print w/replies, xml ) Need Help??


in reply to Sharing data between tests?

Unless efficiency is truly critical, I would avoid Storable, along with any other binary format. Test suites (both code and data) are a form of documentation, and should be in a human-readable format.

Even when the datasets are generated during one test, and (normally) deleted later toward the end of the test suite, a human-readable (and editable) datastore will save you much frustration when diagnosing a failed test.

I have used Data::Dumper, YAML, and Config::Tiny on different projects. I think that Config::Tiny is better suited to true config files that a non-programmer will be editing. If I was saving shared test data today, JSON::XS would be my first choice.

Note that you need not just bundle the data. You can also bundle helper subroutines, that might simply return the data, or might *generate* the data in some expanded format that your tests can easily use, rather than whatever compact format the data might actually live in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-05-30 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (171 votes). Check out past polls.

    Notices?