Question: For the average function do the following: - - - - - - - - - - - - - - - - - -
For the "average" function do the following:
public class Average
public int averageint k int list
int average ;
int n Math.mink list.length;
if n
forint i ; i n; i
average listi;
average averagen;
return average;
pts Write a brief functional description for the function.
pts Generate functional test case based on functional description.
pts Identify and specify the partitions and generate partition test cases.
pts Generate boundary value test cases.
pts Implement the average function in a class Average and generate test cases usingJunit
pts Compile and run the test cases. Record any failures and errors that are reported. Analyze and briefly explain why each of the failures and errors occurs and how you fix them. Correct all the failures and errors until the CUT Component Under Test passes all the test cases.
In case there is no failiure, please inject a fault yourself and complete the section fThat means you need to inject a fault in this average method, and see if your tests can find the fault. For example, instead of i change the code to i or instead of min use max these faults cause the function to not behave as you describe in the section a and since you design your tests according to this description your test should be able to reveal the fault and fail. but if your test did not fail after you inject the fault, then you need to redesign and add a new test to reveal your injected fault.
pts Measure the code coverage using a code coverage tools such as EclEmma. Your test case must achieve branch coverage.
Cobertura is described in Appendix CEclEmma is a Java code coverage analysis for the Eclipse IDE. Check http:wwweclemma.org for updates, documentation and support.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
