schwern / Test-Sims
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (5)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Jun 27 18:45:49 -0700 2009 | |
| |
.perlcriticrc | Mon Jun 29 19:11:56 -0700 2009 | |
| |
.perltidyrc | Mon Jun 29 18:58:39 -0700 2009 | |
| |
Build.PL | Mon Jun 29 20:22:43 -0700 2009 | |
| |
Changes | Sat Jul 04 20:33:33 -0700 2009 | |
| |
MANIFEST | Sat Jul 04 13:17:37 -0700 2009 | |
| |
MANIFEST.SKIP | Sat Jun 27 20:42:50 -0700 2009 | |
| |
META.yml | Sat Jul 04 20:33:33 -0700 2009 | |
| |
README | Mon Jun 29 20:25:25 -0700 2009 | |
| |
inc/ | Mon Jun 29 19:13:26 -0700 2009 | |
| |
lib/ | Sat Jul 04 20:33:33 -0700 2009 | |
| |
t/ | Sat Jul 04 20:31:30 -0700 2009 |
README
Test::Sims is a Perl module to support the Sims testing technique to generate large, complex, interesting, semi-random yet valid data for testing purposes. Here's the slides outlining the technique: http://schwern.org/talks/Generating%20Test%20Data%20With%20The%20Sims.pdf Install as any normal Module::Build Perl module. perl Build.PL ./Build ./Build test sudo ./Build install Or for your own personal use: perl Build.PL --install_base ~ ./Build ./Build test ./Build install Here's an example of making a simple package to generate random dates. package Sim::Date; use strict; use warnings; use DateTime; use Test::Sims; # Create rand_year(), rand_month(), etc... # All exportable on demand or with the :rand tag make_rand year => [1800..2100]; make_rand month => [1..12]; make_rand day => [1..31]; make_rand hour => [0..23]; make_rand minute=> [0..59]; make_rand second=> [0..59]; sub sim_datetime { my %defaults = ( year => rand_year(), month => rand_month(), day => rand_day(), hour => rand_hour(), minute => rand_minute(), second => rand_second(), ); return DateTime->new( %defaults, @_ ); } # Export sim_datetime() export_sims(); And then using it. use Sim::Date; # Random date. my $date = sim_datetime; # Random date in the year 2009 my $date = sim_datetime( year => 2009 );
