Question: Please answer the following questions: Use the following code to answer questions 2 - 4 : public int Fun ( int x , int k
Please answer the following questions:
Use the following code to answer questions :
public int Funint x int k int y
int i ;
while i x
if x
k y x;
k y i;
else
x k ;
y y x;
k x y;
i i ;
if x y
k y x;
else
k y x;
return k;
Draw a flow graph to represent the method Fun. Label the nodes starting with A and the outgoing edges of the decision boxes appropriately.
A
B C
D E F
G H
I
Identify the set P of paths in the flow graph for Fun and a set of test inputs that satisfy for each of the following criteria. You are required to show trace tables for each set of inputs used to achieve the criteria. If coverage cannot be obtained, explain why.
i statement coverage
ii branch coverage
iii. multiple condition coverage MCC
Compute the number of basis paths in the flow graph in Question
Use the following mutant of the code above to answer questions :
public int Funint x int k int y
int i ;
while i x
if x
k y x;
k y i;
else
x k ;
y y x;
k x y;
i i ;
if x y
k y x;
else
k y x;
return k;
Identify two test cases two pairs of x y that strongly kill the mutant above. Clearly show the inputs and the outputs for each test case. Use appropriate trace tables to show how the mutants were killed.
Apply a mutation mathematical operator eg to the code in questions whereby no input will strongly kill the mutant. Describe the change that was made, ie state the line number and what change was made.
Identify two test cases that weakly kill the mutant described in part b Use appropriate trace tables to show how the mutants were killed.
If you cannot find a solution to any of the questions above provide an explanation why it is not possible
Write welldocumented JUnit test cases and a welldocumented Java class containing the method Fun in Question and show the code coverage obtained when executing the test cases developed for:
i statement coverage place in class name StmntCov
ii branch coverage place in class name BranchCov
write a welldocumented code in an IDE, eg Eclipse. Copy and paste the code for the files Question code and the Junit test cases Take a screen shot of the code coverage statement and branch and paste it after the code. Note you should have screen shots: showing statement line coverage and branch coverage for the test cases in Qi; and screen shots for statement line coverage and branch coverage for the test cases in Qii
Write welldocumented JUnit test cases and a welldocumented Java class containing the mutant of the method Fun in Question
i Compare the JUnit test cases and describe the differences between them.
ii Did you find a way to create JUnit test cases that identify a mutant in your code? If so how was it helpful in determining the best way to kill a mutation?
Please answer all the questions with this flow graph from Thanks
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
