Michael G Schwern
2012-08-04 23:57:42 UTC
Executive Summary: If you're using Test::Builder::Tester to test your Test
module, switch to Test::Tester. It will make the transition to Test::Builder
1.5 smoother and avoid future breakage due to TAP formatting changes.
A lot of the work done fixing CPAN Test::* modules to be compatible with
Test::Builder 1.5 has been to do with small changes to the TAP format. The
TAP version header and things like the casing of "# SKIP". Stupid little
things. Testing a test library currently involves comparing the output TAP.
This sucks, even with Test::Builder::Tester.
The whole idea of testing test modules by looking at the formatted output
suuuuucks. Test::Builder::Tester is a gallant effort,
Test::Builder 1.5 is event driven, so there's no need to look at the formatted
output, you can look at the events directly and get a complete view of what's
going on. For example, this test...
ok( 1 );
is( 23, 42 );
done_testing;
Generates something like this:
# TB2::Event::TestStart
# TB2::Result
ok( 1 );
# TB2::Result
# TB2::Event::Log (for the failure diagnostics)
is( 23, 42 );
# TB2::SetPlan
# TB2::Event::TestEnd
done_testing;
There's a couple of interfaces to test via events. Test::Tester is an
existing one that works with both 0.x and 1.5, so that would be the preferred
tool to use now. TB2::Tester is the one specifically written for
Test::Builder 1.5.
My plan is to mark Test::Builder::Tester as "discouraged" and focus on making
it work as a transitional tool. That means emulating as many 0.x quirks as
possible to keep existing TBT-based tests working, but that also means
sacrificing improving it. IMO its approach is dead, so that's ok.
What say?
module, switch to Test::Tester. It will make the transition to Test::Builder
1.5 smoother and avoid future breakage due to TAP formatting changes.
A lot of the work done fixing CPAN Test::* modules to be compatible with
Test::Builder 1.5 has been to do with small changes to the TAP format. The
TAP version header and things like the casing of "# SKIP". Stupid little
things. Testing a test library currently involves comparing the output TAP.
This sucks, even with Test::Builder::Tester.
The whole idea of testing test modules by looking at the formatted output
suuuuucks. Test::Builder::Tester is a gallant effort,
Test::Builder 1.5 is event driven, so there's no need to look at the formatted
output, you can look at the events directly and get a complete view of what's
going on. For example, this test...
ok( 1 );
is( 23, 42 );
done_testing;
Generates something like this:
# TB2::Event::TestStart
# TB2::Result
ok( 1 );
# TB2::Result
# TB2::Event::Log (for the failure diagnostics)
is( 23, 42 );
# TB2::SetPlan
# TB2::Event::TestEnd
done_testing;
There's a couple of interfaces to test via events. Test::Tester is an
existing one that works with both 0.x and 1.5, so that would be the preferred
tool to use now. TB2::Tester is the one specifically written for
Test::Builder 1.5.
My plan is to mark Test::Builder::Tester as "discouraged" and focus on making
it work as a transitional tool. That means emulating as many 0.x quirks as
possible to keep existing TBT-based tests working, but that also means
sacrificing improving it. IMO its approach is dead, so that's ok.
What say?
--
s7ank: i want to be one of those guys that types "s/j&jd//.^$ueu*///djsls/sm."
and it's a perl script that turns dog crap into gold.
s7ank: i want to be one of those guys that types "s/j&jd//.^$ueu*///djsls/sm."
and it's a perl script that turns dog crap into gold.