软件测试代写 | COM3529 Week 2 Practical — Coverage Part 1

本次英国代写主要为软件测试与分析限时测试

COM3529 — SOFTWARE TESTING & ANALYSIS
Week 2 Practical — Coverage Part 1
1. Do the “Who Wants To Be A Software Tester?” Quiz for this week. If you’re unclear about any
of the answers then ask!
2. Navigate to the uk.ac.shef.com3529.lectures package, and open the Triangle class. The
class has a method, classify, that categorises the type of the triangle based on the lengths of
its three sides, which correspond to the parameters to the method — side1, side2, and side3.
The equilateral triangle is one in which all sides are the same length, an isosceles triangle is
one in which at least two sides are the same length, a scalene triangle is any other (valid)
triangle.
(a) Draw the CFG for the classify method.
(b) Write a JUnit test suite for Triangle that gives full Branch Coverage.
(c) Enumerate all the paths through the CFG for the method. (There are no loops in the
method, so this is possible.) Which paths are infeasible?

Week 3 Practical Session
Coverage Part 2
1. Do the “Who Wants To Be A Software Tester?” Quiz for this week. If you’re unclear about any
of the answers then ask!
2. The code segment that returns when a triangle is isosceles could be re-written as:
if ((side1 + side2 > side3) &&
(side1 == side2 || side2 == side3) &&
(side1 != side2 || slide2 != side3)) {
return Type.ISOCELES;
}
For the above branch predicate:
(a) Enumerate each of the conditions.
(b) Determine the test requirements for coverage with Restricted MCDC. Format this as a
table, which shows the truth values of the conditions and the branch predicate in columns
of the table (as done in the lecture). Which test requirements are infeasible, if any?
(c) The same question as before, but this time with Correlated MCDC.
(d) Take either (a) your Restricted MCDC test requirements or (b) your Correlated MCDC
test requirements. Use these to construct a JUnit test suite but run against the original
Triangle class. Note anything unusual about the results of your test suite.
3. Navigate to the uk.ac.shef.com3529.practicals package (do a git pull first), and open the
SpaceDefender class.
(a) Draw the CCFG for this class.
(b) Annotate each node n of the CCFG with defs(n) and uses(n).
(c) Write out the set DU. In particular, identify any elements of DU that are infeasible.
(d) Identify which elements of DU are applicable to

i. All Defs Coverage
ii. All Uses Coverage
iii. All Def-Use Paths Coverage