software testing
Question 1: Please create the control flow chart and related test cases for the following program module.
public static void setWhiteBalls(int []w)
{
Random r = new Random();
w[0] = r.nextInt(68) + 1; // 1st white ball
int k=1;
int n, i;
while (k <= 4)
{
n = r.nextInt(68) + 1;
for (i=0; w[i] != -1 && i < w.length; ++i)
{
if (n == w[i]) // duplicated number
continue; // go back to the top of the loop
} // for
w[i] = n; // a unique number
++k;
} // while
} // setWhiteBalls
Question 2: Please create the control flow chart and related test cases for the following program module.
public static void checkWinner(int []w, int p, int []uw, int up)
{
int matchCnt=0;
for (int k=0; k < w.length; ++k)
for (int i=0; i < uw.length; ++i)
if (uw[i] == w[k])
{
++matchCnt;
break;
}
if (matchCnt > 4)
{
if (p == up)
System.out.println(“You hit the Jackpot!”);
else
System.out.println(“You won Second prize: $1 million!”);
}
else if (matchCnt == 4)
System.out.println(“You won third prize!”);
else
System.out.println(“Better luck netxt time!”);
} // CheckWinner
|
Unit Test Cases |
|
|
Module Name: _________ |
Program Name: ___________ |
|
1. Module Overview |
|
|
Briefly define the purpose of this module. This may require only a single phrase: i.e.: calculates overtime pay amount, calculates equipment depreciation, performs date edit validation, or determines sick pay eligibility, etc. |
|
|
1.1 Inputs to Module |
|
|
[Provide a brief description of the inputs to the module under test.] |
|
|
|
|
|
1.2 Outputs from Module |
|
|
[Provide a brief description of the outputs from the module under test.] |
|
|
|
|
|
2. Test Data |
|
|
(Provide a listing of test cases to be exercised to verify processing logic.) |
|
|
2.1 Positive Test Cases |
|
|
[Representative data samples should provide a spectrum of valid field and processing values including “Syntactic” permutations that relate to any data or record format issues. Each test case should be numbered, indicate the nature of the test to be performed and the expected proper outcome.] |
|
|
2.2 Negative Test Cases |
|
|
[The invalid data selection contains all of the negative test conditions associated with the module. These include numeric values outside thresholds, invalid Characters, invalid or missing header/trailer record, and invalid data structures (missing required elements, unknown elements, etc.) Homework #6 This is an individual assignment. You MUST use the attached test case template. Please name your file as YourLastNameHW6, e.g., YaoHW6.docx or YaoHW6.pdf You must complete Quiz #5, Question #2 before working on this assignment. Based on the control flow chart you created for the following program module, please show at least 4 possible paths so that “Path Selection” software testing can be conducted. public static void checkWinner(int []w, int p, int []uw, int up) { int matchCnt=0; for (int k=0; k < w.length; ++k) for (int i=0; i < uw.length; ++i) if (uw[i] == w[k]) { ++matchCnt; break; } if (matchCnt > 4) { if (p == up) System.out.println(“You hit the Jackpot!”); else System.out.println(“You won Second prize: $1 million!”); } else if (matchCnt == 4) System.out.println(“You won third prize!”); else System.out.println(“Better luck netxt time!”);
} // CheckWinner |
|
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


