All I want for Christmas is less boilerplate

Test::Kit - 2014-12-14

Santa's elves were once again programming away. With the population growing and Christmas more popular than ever they had replaced their hammers and saws with shiny new computers and keyboards, and CPAN modules that could order presents from Amazon and eBay and even Etsy.

It was critical that everything run smoothly, or all the girls and boys of the world would be waking up on Christmas morning to find no presents to mark Santa's visit. So, naturally, the elves had tested their code very thoroughly, taking full advantage of all the CPAN has to offer.

Their t/ directory was bursting with .t files, and every time it came to create a new test a new .t file would be created, and the first 30 or so lines of another random .t file would be copied over to get it started.

One day one particular elf was doing this copy-paste manoeuvre when something came to him in a flash: "Copy pasting code is bad!", he realised, "I would never copy and paste this much code around in lib/SantasWorkshop/ so why is it ok in t/?". And, of course, he realised that it wasn't.

Test Kits

The elf reached for the CPAN and pulled out Test::Kit, and created a shiny new module.

And would you believe that with all those lines of code deleted every test still passed, and every child around the world got their presents?

Advanced Features

When word got around to Santa he was very impressed; so much so that he wanted to give Test::Kit a go on his own projects. As he read the POD for the module he let out a jolly "ho ho ho!" when he saw a feature he thought was very nice.

1: 2: 3: 4: 5: 6: 7: 8: 9: 10:

packageSanta::NaughtyNice::Test;

useTest::Kit;

include'Test::More'=>{renamed=>{'ok'=>'nice','fail'=>'naughty',},};

Now he could assert in his tests that variables were nice(), and if anything went really wrong he just needed to use naughty() to add a 'not ok' to his test output.