Skip Menu |

This queue is for tickets about the Test-Class CPAN distribution.

Report information
The Basics
Id: 66355
Status: resolved
Priority: 0/
Queue: Test-Class

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Add ability to augment test descriptions
I use Test::Class::Load to drive the testing, and I often have multiple tests being run in each test method. This leads to lots of anonymous looking output unless I personalize each error message. E.g.: package TestClass0; use base qw[ MyTestBase ]; sub test0 : Test(2) { ok( 1, 'TestClass0::test0: check 1' ); ok( 1, 'TestClass0::test0: check 2' ); } It'd be much easier if Test::Class could be configured to prefix the output message with the name of the class & test method. There doesn't seem to be any easy way of overriding any of the Test::Class methods to do this. Perhaps adding a "munge_description" method which is called with the method name and existing description and which returns a new description? The caller could then override that and provide whatever capabilities are required. Thanks, Diab
Hi, Belated response to your request On Thu Mar 03 12:05:10 2011, DJERIUS wrote: Show quoted text
> I use Test::Class::Load to drive the testing, and I often have multiple > tests being run in each test method. This leads to lots of anonymous > looking output unless I personalize each error message. E.g.:
[snip] If you run in verbose mode Test::Class automatically annotates each Test::Method with a diagnostic message before it's run. For example: $ TEST_VERBOSE=1 perl example.t # # Foo::Test->failure 1..2 not ok 1 - this test fails # Failed test 'this test fails' # at example.t line 16. # (in Foo::Test->failure) # # Foo::Test->success ok 2 - this test passes # Looks like you failed 1 test of 2. Also, as you can see above, test failures always include the class/method that failed in the diagnostics so you can find the location of failing tests. In the (nearish) future Test::Class will be moving to use subtests, which will also produce a more meaningful output :-) Hope that helps. Cheers, Adrian