Question: 1 . ( 2 5 points ) Due to the use of polymorphism, to achieve a certain coverage of testing we need to try all
points Due to the use of polymorphism, to achieve a certain coverage
of testing we need to try all possible implementations of a function that was
overridden in subclasses. So while providing some benefits, the use of
polymorphism makes coverage testing mor difficult.
Use an example with abstract class Shape and its subclasses Circle and
Rectangle all of which have method float area Assuming the size of List
shapes remains to be what permutations of instances of Circle and
Rectangle we have to test for due to polymorphism to achieve branch
coverage
List shapes new ArrayList;
list shapes is populated with any permutation of instances of Circle andor Rectangle
class dynamically, say, from a user interface
float sumOfAreas f;
forShape shape : shapes
sumOfAreas shape.area;
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
