testing and debugging testing is the process of experimentally checking the correctness of programwhile debugging is the process of tracking the execution of program and discovering the errors in it testing and debugging are often the most time-consuming activity in the development of program testing careful testing plan is an essential part of writing program while verifying the correctness of program over all possible inputs is usually infeasiblewe should aim at executing the program on representative subset of inputs at the very minimumwe should make sure that every method of class is tested at least once (method coverageeven bettereach code statement in the program should be executed at least once (statement coverageprograms often tend to fail on special cases of the input such cases need to be carefully identified and tested for examplewhen testing method that sorts (that isputs in ordera sequence of integerswe should consider the following inputsthe sequence has zero length (no elementsthe sequence has one element all the elements of the sequence are the same the sequence is already sorted the sequence is reverse sorted in addition to special inputs to the programwe should also consider special conditions for the structures used by the program for exampleif we use python list to store datawe should make sure that boundary casessuch as inserting or removing at the beginning or end of the listare properly handled while it is essential to use handcrafted test suitesit is also advantageous to run the program on large collection of randomly generated inputs the random module in python provides several means for generating random numbersor for randomizing the order of collections the dependencies among the classes and functions of program induce hierarchy namelya component is above component in the hierarchy if depends upon bsuch as when function calls function bor function relies on parameter that is an instance of class there are two main testing strategiestop-down and bottom-upwhich differ in the order in which components are tested top-down testing proceeds from the top to the bottom of the program hierarchy it is typically used in conjunction with stubbinga boot-strapping technique that replaces lower-level component with stuba replacement for the component that simulates the functionality of the original for exampleif function calls function to get the first line of filewhen testing we can replace with stub that returns fixed string