dev:testing:debugging_perl_unit_tests
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dev:testing:debugging_perl_unit_tests [2024/11/29 21:57] – created sandbergja | dev:testing:debugging_perl_unit_tests [2024/12/01 11:20] (current) – [Using a debugger in Perl unit tests] sandbergja | ||
---|---|---|---|
Line 5: | Line 5: | ||
The following steps work for unit tests (i.e. the tests in Open-ILS/ | The following steps work for unit tests (i.e. the tests in Open-ILS/ | ||
- | If there is a test that already calls the subroutine you're interested in: | + | ===== If there is a test that already calls the subroutine you're interested in ===== |
- Note the filename of the test, and the line number that calls the Perl code you'd like to debug. In our case, we'd like to investigate '' | - Note the filename of the test, and the line number that calls the Perl code you'd like to debug. In our case, we'd like to investigate '' | ||
- Start a docker dev container using the instructions on docker hub | - Start a docker dev container using the instructions on docker hub | ||
Line 25: | Line 26: | ||
- When you are done exploring: enter '' | - When you are done exploring: enter '' | ||
+ | ===== If you have failing tests ===== | ||
+ | |||
+ | Sometimes your test code or production code will have an error that causes it to die. Sometimes this will cause multiple tests or subtests to fail. If this happens, you can run into frustrating situations where you set a breakpoint within a failing test, enter '' | ||
+ | |||
+ | * Make sure to put your breakpoint before or at the **first** line that is failing, or | ||
+ | * If you want to debug, say the second failing test, you can use [[https:// | ||
===== If there is not an existing unit test for the code you want to explore ===== | ===== If there is not an existing unit test for the code you want to explore ===== | ||
Line 61: | Line 68: | ||
If it relies on a complex object, but you can pass it in, you can use '' | If it relies on a complex object, but you can pass it in, you can use '' | ||
+ | |||
+ | ===== Further resources ===== | ||
+ | |||
+ | * [[https:// | ||
{{tag> | {{tag> | ||
dev/testing/debugging_perl_unit_tests.1732935462.txt.gz · Last modified: 2024/11/29 21:57 by sandbergja