Question: Testing program in Java: * Read in equivalence.txt file . This file is only one example, and could contain any number of rows when being

Testing program in Java:

* Read in "equivalence.txt" file. This file is only one example, and could contain any number of rows when being tested. Each row could have any number of equivalence classes. Equivalence classes are separated by a ";" in the txt file. Each row is a different variable (n1, n2, n3, ...).

....contents of "equivalence.txt":

1, 20; 21, 40

1,10; 11, 30

1,6; 7, 13; 14, 25

1,30; 31,40; 41,60; 61,100

* Generate test cases using the Strong Normal Equivalence Class testing technique, based on the number of variables in the txt file (this will need to be varied, not set to only the 4 variables above). Use recursion to generate these test cases, since the number of variables may vary based on the txt file tested.

* Output the test cases to a txt file (you can name it "testCases.txt)

* Read in the testCases.txt, and put into JUnit

* Use the data from testCases.txt in the function "public int sum(n1, n2, n3, nx)" with 'x' being the number of variables in the equivalence.txt file (remembering that this will vary based on the txt file being tested). This function should call an internal method "private int eqClass(int value)" that returns the equivalence class that 'value' is in. For example, if the test case is '1, 20, 10, 70' then eqClass should return 1, 2, 2, 4 respectively when the four variables are tested. The function "sum" then adds up the equivalence classes (in the previous example it would be '9'), and prints each test case and result to a new txt file "testResults.txt". This output should list each number tested separated by commas, and then the sum.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!