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 in the program 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 orderan array of integerswe should consider the following inputsthe array has zero length (no elementsthe array has one element all the elements of the array are the same the array is already sorted the array 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 an array to store datawe should make sure that boundary casessuch as inserting/removing at the beginning or end of the subarray holding dataare properly handled while it is essential to use hand-crafted test suitesit is also advantageous to run the program on large collection of randomly generated inputs the random class in the java util package provides several methods to generate random numbers there is hierarchy among the classes and methods of program induced by the caller-callee relationship namelya method is above method in the hierarchy if calls there are two main testing strategiestop-down and bottom-upwhich differ in the order in which methods are tested bottom-up testing proceeds from lower-level methods to higher-level methods namelybottom-level methodswhich do not invoke other methodsare tested firstfollowed by methods that call only bottom-level methodsand so on this strategy ensures that errors found in method are not likely to be caused by lower-level methods nested within it top-down testing proceeds from the top to the bottom of the method hierarchy it is typically used in conjunction with stubbinga boot-strapping technique that replaces lower-level method with stuba replacement for the method that simulates the output of the original method for exampleif method calls