Lab Assignment
Part 1: The Program. You will need a program that allows a player to play Cows and Bulls (anumbers game similar to the board game Mastermind).
Use the following guidelines when writing your program:
- Required: The program should generate a to-be-guessed 4-digit number randomly. (You don't have to test the randomness; you already know how to do that)
- Highly recommend (for testing purposes): The tester can override the randomly-generated, 4-digit start number from the keyboard, instead of having the number picked randomly.
- Required: Neither the secret number nor the guesses are allowed to have repeated digits.
- Required: Numbers with leading zeros areallowed.
- Required:The program may terminate the game after 10 tries if the player has not correctly guessed the number.
Note: You can write this program yourself, or you can use code found online, or you do a combination of both. (Just don't claim to have written the code yourself if you used someone else's code.) You will need to be able to runthe code.
Part 2: The test plan:Write a test plan designed to test if the game is functioning correctly. You must decide if this test plan could be executed in a single game, or in multiple games. Focus on the part of the game that gives feedback to the user based on their guess.
Part 3: white box testing:. Draw a flow graph for your code, or for a subset of your code. How much of your code ultimately gets included in the flow graph depends on the cyclomatic complexity of the code. Your graph should have a Complexity Metric of at least 4, but no more than 9.Do not use too small a section of code (you will be penalized for making things too easy on yourself), or too lengthy a section of code (you will make your task unnecessarily difficulty)
Next: Figure out how to achieve Statement Coverage and Branch Coverage in the graph. This means listing two sets of paths that go through the graph - the first set achieves Statement Coverage and the second set achieve Branch Coverage. You will not have to achieve Path Coverage for this assignment.
Finally: Make sure your test cases generated in Part 2 achieve Branch Coverage and Statement Coverage, as outlined in Part 4. If they do not, then oh, no! You have untested statements or branches! To rectify this, add test cases to your test plan so that it achieves Branch Coverage (or, if this is impossible for some reason, explain why in your documentation).
IMPORTANT:
Take a screen shots of the code run the code and do the test take screenshots of the output too!
Put everything in one WORD DOCUMENT, not only the code is important make sure to do some writing like part 2 (test plan) and explanations!
Summary of the lab (White Box Testing)
Part 1: Write or obtain the game code.
Part 2: Write the test plan to test the game.
Part 3: Draw the flow graph & do the flow analysis
Part 4: Ensure your test cases achieve statement and branch coverage. If they don't add to your test plan.
Format your assignment according to the following formatting requirements:
1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.
2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.
3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.
Attachment:- Lab-Assignment.rar