Designing and testing a script to facilitate debugging might significantly reduce test maintenance costs. The following suggestions
might help you create debuggable scripts:
- Plan for debugging and robustness when you are designing a script, by having your functions check for valid input and output,
and by performing operations in the script that inform you if a problem occurs.
- Test each function while you write it, by building it into a small script that calls the function with test arguments and
performs some functional validation. When you have finished the coding of a script, you can use the debugger to step through
the execution of each function in the script.
- To find errors in control loops, test each routine with the full range of valid data values, including the highest and lowest
valid values.
- Test each routine with invalid values to ensure that the routine rejects such values without crashing.
- Test each routine with null (empty) values. Depending on the purpose of the script, it might be useful to provide default
values if the input is incomplete.