# Software Architecture – Test&Maint

I’m studying for my Computer Science class and need an explanation.

Hello,

I need someone that can finish these two exercises.

Assignment #2

Turn in your work as a single Word or PDF file.

 Problem 1 Problem 2 Total 1.1 1.2 1.3 2.1 2.2 2.3 2.4 2.5 10 pts 10 pts 10 pts 20 pts 10 pts 10 pts 15 pts 15 pts 100 pts
• Given TaxReturn.java, design a minimum set of test cases that fully achieves the decision coverage of the getTax method. The decisions are as follows:
• List the test cases (inputs only; oracle values are not needed) in Table 1.1. Add rows as needed.
• void isPrimeNumber(int number) is a method that reports whether or not a given integer is a prime number.
• Draw a control flow graph of isPrimeNumber, using the given numbers to identify the nodes in the graph. Each number represents a block of code (one or more line). Use a computer-aided tool to draw the graph. Handwritten answer will not be accepted.
• Enumerate all the independent paths.
• Create a test case (test input, no oracle value) for each of the independent paths (only if feasible) and write a Junit class, PrimeNumberTest.java, in the “tests” package to implement all the test cases. Here is a sample test (“13” may not be needed in your solution):
 status == SINGLE income <= SINGLE_CUTOFF1 income<= SINGLE_CUTOFF2 income <= MARRIED_CUTOFF1 income<= MARRIED_CUTOFF2

Table 1.1 Test cases (test inputs)

 Test case no Test input status income

Table 1.2 Decision coverage

 Decision Test Case ID (s) True False status == SINGLE income <= SINGLE_CUTOFF1 income<= SINGLE_CUTOFF2 income <= MARRIED_CUTOFF1 income<= MARRIED_CUTOFF2

@Test

public void test () {

TaxReturn aTaxReturn = new TaxReturn(10000, 2);

System.out.println(“Your tax is ” + aTaxReturn.getTax());

}

Run your Junit tests with a code coverage analysis tool. If you use EclEmma in Eclipse, right click on TexReturnTest.java, select “Coverage As” from the menu, and then select “Junit Test”.

If your test cases in Table 1.1 have achieved the decision coverage, then every line of the code in the getTax method should be covered, as shown in the following screenshot.

Provide in this document the source code of your TaxReturnTest.java, a screenshot of the test execution, and a screenshot of the coverage information.

 Node no Code start 1 2 3 4 5 6 7 8 9 end public static void isPrimeNumber(int number) { if (number > 1) { boolean isPrimeNumber = true; int i = 2; while (isPrimeNumber && i < number) { if (number % i == 0) isPrimeNumber = false; else i++; } if (isPrimeNumber) System.out.println(number + ” is a prime number.”); else System.out.println(number + ” is not a prime number.”); } else { System.out.println(“Please input a number greater than 1.”); } }

@Test

public void test3() {

}

Provide in this document the source code of PrimeNumberTest.java, a screenshot of the test execution results in the console window, and a screenshot of the code coverage for isPrimeNumber.

2.4 Complete the following Definition/Use table for isPrimeNumber.

 Node number Variables Definition C-Use P-Use start 1 2 3 4 5 6 7 8 9

2.5 Complete the following Definition/Use Associations table for isPrimeNumber. Add rows as needed.

 Variable Def node Def-C-Uses Def-P-Uses

### "Looking for a Similar Assignment? Order now and Get a Discount! 