diag prints out a message along with the rest of the output.

Use it for whatever extra output in order to ensure that your printouts will not interfere with future changes in the test environment modules (such as Test::Harness).

diag "We are going to test the Foo-Bar device now";
# We are going to test the Foo-Bar device now
examples/perl/t/33.t
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";
is(sum(2, 2, 2), 6,  '2+2+2');

$ perl t/33.t

1..3
# Add two numbers
ok 1 - 1+1
ok 2 - 2+2
# Add 3 numbers
not ok 3 - 2+2+2
#   Failed test '2+2+2'
#   at t/33.t line 14.
#          got: '4'
#     expected: '6'
# Looks like you failed 1 test of 3.

$ perl ../harness.pl t/33.t

t/33.t .. # Add two numbers
t/33.t .. 1/3 # Add 3 numbers

#   Failed test '2+2+2'
#   at t/33.t line 14.
#          got: '4'
#     expected: '6'
# Looks like you failed 1 test of 3.
t/33.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests 

Test Summary Report
-------------------
t/33.t (Wstat: 256 Tests: 3 Failed: 1)
  Failed test:  3
  Non-zero exit status: 1
Files=1, Tests=3,  0 wallclock secs
    ( 0.02 usr  0.01 sys +  0.02 cusr  0.00 csys =  0.05 CPU)
Result: FAIL
Failed 1/1 test programs. 1/3 subtests failed.