Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 . ( 5 0 points ) Consider the following program: class M { public static void main ( String [ ] argv ) {
points Consider the following program:
class M
public static void mainString argv
M obj new M;
if argvlength
obj.margv argv.length;
public void mString arg, int i
int q ;
A o null;
Impossible nothing new Impossible;
if i q ; q; switch arglength
case : q ; break;
case : o new A; new B; q ; break;
case : o new A; q q ; no break
default: o new B; break;
if arglength om;
else
System.out.printlnzero;
nothing.happened;
class A
public void m
System.out.printlna;
class B extends A
public void m System.out.printlnb;
class Impossible
public void happened
bb whatever the answer nothing happens here
a Using the minimal number of nodes hint: draw a Control Flow Graph CFG for method
Mm and include it in your submission. The CFG should be at the level of basic blocks. See the lecture slides on CFG for examples.
b List the sets of Test Requirements TRs with respect to the CFG you drew in part a for each of the following coverages: node coverage; edge coverage; edgepair coverage; and prime pathcoverage. In other words, write four sets: TRNC TREC TREPC and TRPPC If there are infeasible test requirements, list them separately and explain why they are infeasible.
c Create test sets for method Mm that achieve each of the following coverages: node
coverage but not edge coverage; edge coverage but not edgepair coverage; edgepair
coverage but not prime path coverage; and prime path coverage. In other words, you will
write four test sets groups of test cases in total. One test set satisfies one satisfies one
satisfies and the last satisfies if possible. If it is not possible to write a test set to satisfy
or explain why. For each test case written, explain which TRs are satisfied by
that test. Consider feasible test requirements only for this part.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started