Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Get the number of the current test when debugging a test script

by jeffa (Bishop)
on Jun 30, 2015 at 16:51 UTC ( [id://1132642]=note: print w/replies, xml ) Need Help??


in reply to Get the number of the current test when debugging a test script

"There's a bug in the module that is causing the test to fail after a certain test number."

But which test number? You wrote the tests ... which test is failing? The output will show you. Since you provided no code and no actual error output, i'll have to supply my own. I changed one value in one my modules and ran the test suite. This was the first error of 14 failed tests in two test files:

# Failed test 'north: correct HTML from method call' # at ./t/07-theta-presets.t line 106.

If i look at that test file on line 106 i see:

is $table->north, $expected, "north: correct HTML from method call";
From here i have to go back to the definition of north() and this was indeed the function that i changed a value in. No need for a debugger ... i know where the error is now. If i still can't see the error i can fall back on a debugger, but i find that emitting dumps of data to STDERR is faster for me. Read the test output -- if you can't determine where the problem is quickly then your tests are probably too complicated. Tests help to eliminate the need for a debugger if you have exhaustive coverage. Keep your tests simple and fast.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Get the number of the current test when debugging a test script
by Dumu (Monk) on Jun 30, 2015 at 17:22 UTC

    Thank you for taking the time to answer, jeffa.

    Apologies, the code was highly work-specific and it felt like it would have taken a long time to create an example test and module without adding anything.

    I was interested in the general case of running the standard debugger on any Test::Most (or presumable Test::More or Test::Simple) test script and stopping after a certain test, by number. So I felt that to post code would not necessarily add much helpful info.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1132642]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-28 20:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found