Computer Packages

 

 

Download isbnAssignment.zip and unzip it. The source code consists of seven packages: correct and mutantX(X=1..6). Each package contains a class ISBN10.java. In the “correct” package, ISBN10.java has a correct version of the method “boolean isValidISBN(String isbn)”. In each mutantX package, ISBN10.java contains a modified version of isValidISBN. Do not make any change to the code. If you choose to use a different language, it is your responsibility to translate all the code correctly.

The isValidISBN method returns true if a given string isbn is a valid ISBN-10 number, i.e., meets the following conditions:

(a) the length is 10,

(b) the first 9 characters are all digits,

(c) the 10-th character (check digit) is a digit or ‘X’. ‘X’ means 10 (suppose ‘x’ is invalid).

(d) the weighted sum of the 10 digits, defined below, is a multiple of 11.

where xi represents the i-th digit. For example, the weighted sum of “0306406152” is:

(0 *10) + (3*9) + (0*8) + (6*7) + (4*6) + (0*5) + (6*4) + (1*3) + (5*2) + (2*1)

= 0 + 27 + 0 + 42 + 24 + 0 + 24 +3 +10 +2

= 132 = 12 *11

You may create your test cases by using and modifying known ISBN-10 numbers. Some can be found at: https://en.wikipedia.org/wiki/International_Standa…

Decision Table
Complete the following decision table, where T/F/DC represent True /False/Don’t Care, respectively. Each entry in the “length=10” column should be either T or F. Each entry of “The 1-9 characters are all digits” or “The weighted sum is a multiple of 11” should be T, F, or DC. The three entries, “is digit”, “is X”, and “is not digit or X”, in each row are mutually exclusive – no more than one of them should be T. (15 points)
Create one test case for each variant in the completed decision table in Problem 1.1. List all test cases in the following table. (10 points)
Write a JUnit class ISBN10DecisionTableTest.java in the “correct” package to implement all the test cases in Problem 1.2. Run and debug this class in the “correct” package until there is no failure. If there is a failure, then something is wrong with your tests and you must fix it before moving on to the next problem. Include in this document the source code of your ISBN10DecisitionTableTest.java and a screenshot of your test execution that shows no failure. (7 points)
Copy your ISBN10DecisionTableTest.java in Problem1.3 to each mutantX (X=1..6) package. Make sure the package statement in ISBN10DecisionTableTest.java is correct so that you can test ISBN10.java in the same package. Report your test execution results in the following table and include a screenshot of the test execution for each mutantX package. (6 points)
Equivalence Partitioning and Boundary Value Analysis
Complete the following table of equivalence classes. (15 points)
Combine the valid and invalid classes of all conditions in Problem 2.1. (15 points)
Complete the following table of boundary values according to the valid and invalid classes in Problem 2.1. (10 points)
Complete the following table of test cases based on the test input requirements in Problem 2.2 and the boundary values in Problem 2.3. There should be at least one test case for each test input requirement in Problem 2.2. The test cases should cover each boundary value at least once (10 points)
Write a JUnit class ISBN10PartitioningTest.java in the “correct” package to implement all the test cases in Problem 2.4. Run and debug this class in the “correct” package until there is no failure. If there is a failure, then something is wrong with your tests and you must fix it before moving on to the next problem. Include in this document the source code of ISBN10PartitioningTest.java and a screenshot of your test execution that shows no test failure. (6 points)
Copy your ISBN10PartitioningTest.java in Problem 2.5 to each mutantX (X=1, 2, …, 6) package. Make sure the package statement in ISBN10PartitioningTest.java is correct so that you can test ISBN10.java in the same package. Report your test execution results in the table below and include in a screenshot of the test execution for each mutantX package. (6 points)
Variant

Condition

Action

(valid or invalid ISBN-10 number)

length=10

The 1-9 characters are all digits

The 10th character

The weighted sum is a multiple of 11

is digit

is ‘X’

is not digit or ‘X’

Add more rows as needed.

Test No

Test Input (isbn)

Oracle Value

Add more rows as needed.

Mutant Version

Test failure: Yes or No?

If Yes, list the tests that failed

1

2

3

4

5

6

Condition

Valid classes

Invalid classes

Length=10

Each of the first 1-9 characters is a digit

The 10th character is a digit or ‘X’

The weighted sum is a multiple of 11

Each combination involves one valid or invalid class of each condition in the above equivalent class table. When a combination contains only valid classes of different conditions, it may cover as many uncovered valid classes as possible. When it contains an invalid class, however, it should cover only one invalid class and use valid classes for other conditions. Here is an example combination (called test input requirement), which covers a valid class for each condition:

Length=10,

Each of the first 1-9 characters is a digit,

The 10th character is a digit,

The weighted sum is a multiple of 11

Complete the following table such that each valid and invalid class should appear at least once.

#

Test input requirement

Expected result

Add more rows as needed.

Condition

Boundary values from valid classes

Boundary values from invalid classes

Length=10

Each of the first 1-9 characters is a digit

The 10th character is a digit or ‘X’

The valid and invalid classes of “The weighted sum is a multiple of 11” are not listed here. You should consider them when creating test cases in the next problem.

Note: when creating a test case of invalid ISBN-10 number to cover the condition of invalid length or invalid character, you don’t need to ensure that the weighted sum of the test input is a multiple of 11 (it would be great if you can do it, but this is not required).

Test case #

Test input requirement # in Problem 2.2

Test Input (isbn)

Expected result

Add more rows as needed.

Mutant Version

Test failure: Yes or No?

If Yes, list the tests that failed

1

2

3

4

5

6

This question has been answered.

Get Answer