When you don't want to see the failing tests any more

use strict;
use warnings;

use lib 'lib';
use MyTools;

use Test::More tests => 3;

diag "Add two numbers";
is(sum(1, 1),    2,     '1+1');
is(sum(2, 2),    4,     '2+2');

diag "Add 3 numbers";
    local $TODO = "fix bug summing more than 2 values #173";
    is(sum(2, 2, 2), 6,  '2+2+2');

$ perl t/34.t

# Add two numbers
ok 1 - 1+1
ok 2 - 2+2
# Add 3 numbers
not ok 3 - 2+2+2 # TODO fix bug summing more than 2 values #173
#   Failed (TODO) test '2+2+2'
#   at t/34.t line 16.
#          got: '4'
#     expected: '6'

In the eXtreme Programming paradigm the following two key aspects are somewhat in contradiction: 1) Write your test before you write your code. 2) Make sure your test suit always passes at 100%.

Of course after you already wrote your tests for a new feature but before you can write the actual code there is a short time period when your test suit will not pass 100%.

Worse than that, it is also recommended that immediately when you get a bug report from somewhere you should write a test case that reproduces this bug. Obviously this test will fail before you fix the bug and will hopefully pass once you fixed it.

In order to make the test suit happy there is a way to tell the harness tool that a test is *supposed to fail*. That is, we know it will fail. What we can do to achieve this is to set one or more tests to be in a TODO block.

TODO with prove

$ prove t/34.t

t/34......# Add two numbers
# Add 3 numbers
All tests successful.
Files=1, Tests=3,  0 wallclock secs
  ( 0.00 usr  0.00 sys +  0.02 cusr  0.00 csys =  0.02 CPU)
Result: PASS