Hi > > I would like to hear your thoughts on how, given a specific method for > which you plan to improve coverage, how would you go about identifying a > functional test case which will cover the method. This will of course be > the tricky bit of all of this.
For determining a functional test case for a method, first it needs to determined what the method is supposed to do (from documentation related to the class). Then it needs to be analyzed what flow of code exercise this method.Then I would write a prototype code to test what the method does when actually executed. (Probably some bugs may be determined from here as well) Once this is determined,next step would be to look at the expected input and output for the method and write a test case for the scenario in which the method is invoked (something like a black box to test if things work for expected input ot not). Next, within the method, there may be many controls flows which also need to be exercised depending upon the input parameters and the way from which the method has been invoked. Test case would then be added to exercise these cases as well. Also, negative tests also needs to be performed and write test cases for it since testing also requires if things fail when they are supposed to fail. Regards Siddharth Srivastava
