Problem

Correct the faults in the isLeapYear() and getNumDaysInMonth() methods of Figure 1, and ge...

Correct the faults in the isLeapYear() and getNumDaysInMonth() methods of Figure 1, and generate test cases using the path testing method. Are the test cases you found different than those of Table and Figure 2? Why? Would the test cases you found uncover the faults you corrected?

Figure 1 An example of a (faulty) implementation of the getNumDaysInMonth() method (Java).

Figure 2 Equivalent flow graph for the (faulty) isLeapYear() method implementation of Figure, (UML activity diagram) and derived tests. The test in italic is redundant with a test we derived for the getNumDaysInMonth() method.

Table: Test cases and their corresponding path for the activity diagram depicted in Figure 3.

Test case

Path

(year = 0, month = 1)

{throw1}

(year = 1901, month = 1)

{n=32 return}

(year = 1901, month = 2)

{n=28 return}

(year = 1904, month = 2)

{n=29 return}

(year = 1901, month = 4)

{n=30 return}

(year = 1901, month = 0)

{throw2}

Figure 3 Equivalent flow graph for the (faulty) implementation of the getNumDaysInMonth() method of (UML activity diagram).

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT