January 2013 Archives

Test::Class::Moose on the CPAN

I have previously written about Test::Class + Moose, but now it's on the CPAN. I've added a few things to the initial version:

  • Add class/method skipping.
  • Rename almost every overrideable method to /^test_/.
  • Add a time reporting class. You can now fetch real, user and system time for each class or test method.
  • Make sure we have hi-res time reporting
  • Move statistics gathering into its own classes
  • Add include/exclude test method filtering
  • Skip a test class if we don't find any test methods
  • Most attributes pushed into Test::Class::Moose::Config
  • Added "randomize" attribute per Udo Oji.

Let me know your thoughts or if there's anything else you think it needs.

Economics 101

Take a look at this graph of alternate browser adoption:

Firefox adoption dropped 20% in a year and a half on that chart. What does that tell you about Firefox? Nothing. That's the problem.

Be Careful With state Variables

I use state variables a lot. They're great for creating a private cache in a method. However, I was recently asked about using them with Roles. What happens when the role methods are flattened into separate namespaces? I suspected that they would share their state, but I wasn't sure, so I wrote a quick check.

How to write a test description

If you were to read the TAP grammar, you would see the following line:

test ::= status positiveInteger? description? directive?

What that means is that a test line of TAP (if you read the rest of the grammar) must have an "ok" or "not ok" bit, followed by an optional test number (in practice, it's almost always there) and a test description (the directive refers to "skip" or "todo" tests). Sadly, many people don't pay attention to the powerful benefits of the description. A bad description may as well be left off; a good description is the difference between a pile of confusing code and documentation.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/