So the answer seems to be that you can just create a reference to the $builder object at any time, either in your test script:

my $builder = Test::Most->builder;

or in the debugger ('my' doesn't seem to play well on the debugger command line):

NB for newbies: the DB<x> bit is the debugger prompt, not part of the code.
DB<x> $builder = Test::Most->builder;

If you do either of the above, you should find you can subsequently do either of the following in the debugger to print out the current (actually, the latest) test number:

DB<x> x $builder->{Curr_Test} DB<x> p $builder->{Curr_Test}

- or, as I originally sought to do, run the debugger and break after a particular test, e.g. test #20:

DB<x> w $builder->{Curr_Test} == 20 DB<x> c

Some Monks seem uncomfortable with the idea of running a test script through a debugger. I can sort of understand what you're saying, folks: a test script is effectively a static debugging service, so why run it through the debugger as well? I have a few answers to this but the simplest are:

"... Perl tests are just Perl code." -- chromatic, in Organizing Perl Test Files
"TIMTOWTDI!" -- TimToady

Feel free to get in touch if you would like a couple more.


In reply to Re^2: Get the number of the current test when debugging a test script by Dumu
in thread Get the number of the current test when debugging a test script by Dumu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.