Default test names in Test::Class

Adrian on 2004-02-15T00:01:15

Another week. Another Test::Class release.

A minor tweak to the new support for default test names. I also got around to documenting it :-) You can now do:

sub one_plus_one_is_two : Test { is 1+1, 2 }

and Test::Class will produce

ok 1 - one plus one is two

So as long as you name your methods well you don't have to add in a test name. Useful if you're writing in the one-test-per-method style.

That's it (apart from fixing MANIFEST so we actually include the tests for the new features from the last few releases - sigh...)

Resolution-o-meter: v1.0
Week: 7, 3 weeks behind
01-02-03-04-05-06-07 08 09 10 11 12 13
14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49 50 51 52

Holding steady at three weeks behind. See y'all next time.


Ack!

petdance on 2004-02-15T02:21:12

Good God, who would write one test per method!?!?

Re:Ack!

Adrian on 2004-02-15T02:44:32

Good God, who would write one test per method!?!?

Heh ;-) See this thread on the TDD list for a looooong discussion of some of the pros and cons.

Think of it as taking test isolation to the extreme. As soon as you have more than one test per-method you are potentially introducing dependencies between the tests. Instead push stuff out into the test fixtures and keep each test independent.

I'm not convinced myself yet. However, since some people seem to be having some success with it I'm going to play with it a bit.

Re:Ack!

Adrian on 2004-02-24T13:49:59

Dave Astels talks more about having one assertion per test method for anybody who is interested.