I need to be able to do something like this:

    my $tb = Test::Builder->new;   # it's a singleton
    $tb->start_todo($message);
    $self->run_a_boatload_of_tests;
    $tb->end_todo;

Any issues with this approach?  Schwern, would you take a patch?

Background info as to why (you can skip this unless you want to see a use case 
for the above):

At our work, we have a YAML test framework which allows us to specify our tests 
in a declarative framework.  Here's a tiny (reworked) example.  There are 
several tests, all in the response:

  - http:
      message: We can get change events
      request:
        method: GET
        path: api/v1/change?rows=100
        headers:
          user: client
      response:
        status_is: 200
        xpath_is:
          - '/p:pips/p:[EMAIL PROTECTED]'
          - '/p:pips/p:changes/p:[EMAIL PROTECTED]"b006tjwk"[EMAIL 
PROTECTED]"create"]'
        regex_is:
          - Children's Hour

The problem is that our acceptance tester writes tests and wants to check them 
into the branch we're working on, but this means checking in broken tests.  I 
would like the tester to add a 'todo:' tag to the response:

      response:
        todo: Work in progress
        status_is: 200
        xpath_is:
          - '/p:pips/p:[EMAIL PROTECTED]'
          - '/p:pips/p:changes/p:[EMAIL PROTECTED]"b006tjwk"[EMAIL 
PROTECTED]"create"]'
        regex_is:
          - Children's Hour

However, as you can imagine, there's a lot of stuff underlying those different 
tests and duplicating the 'TODO' wrapper around all of them in all of our test 
methods would be a pain in the rear, not to mention fragile (particularly since 
T::B can get confused about whether or not something is a TODO.  Just look at 
the code for it).

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Reply via email to