Documentations for the reported bugs (Manpreet Kaur Walia) - GaganjotKaurSaini/Debugging_Game GitHub Wiki
Test Name |
Set Balance Limit 0 |
||||||||||
Use Case Tested: |
Player.java |
||||||||||
Test Description: |
Game will over when the player balance goes to 0. |
||||||||||
Pre-conditions |
Player must have some money for play game. |
||||||||||
Post-conditions |
Player will lose all the money at the end. |
||||||||||
Notes: |
According to rule while playing the game if player lose all the money and his balance become 0 then game will stop but in this scenario game is over when player remains balance $5. |
||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
||||||||||
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
1. |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
2. |
Dice rolled |
Lose the bet |
P |
|
|||||||
3. |
Result |
Player balance 0 and Game over. |
|
F |
|||||||
Test Data Table |
|||||||||||
|
1 |
2 |
3 |
4 |
5 |
||||||
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
Balance |
25(after win) |
$ 20 (after lose) |
$ 20(after win) |
$10 (after lose) |
$5 (after lose) |
||||||
Error in player.java class
Method |
Parameters |
Mutates |
Returns |
Constructor |
String name, Int age, Int balance |
Check the name, age and balance of player should not be null. |
Object reference. |
Set Limit |
Int limit |
Limit cannot be 0 |
Void |
blanceExceedsLimit |
---- |
If balance greater than limit then show the balance. |
Boolean |
blanceExceedsLimitBy |
Int amount |
Game ends when balance greater than limit. |
Boolean |
takeBet |
Int bet |
Cheks the conditions for bet. |
int |
receiveWinnings |
Int winnings |
If winnings less than 0 throw exception. |
int |
tostring |
|
|
Name, balance, limit |
Code with buggy behaviour
Origin of code is in line no 59. Below is the screen shot which shows the code with origin of bug and output where game ends when player balance is $ 5.
Origin of code
Code and output after eradicated bug.
Test Name |
Set Balance Limit 0 |
||||||||||
Use Case Tested: |
Player.java |
||||||||||
Test Description: |
Game will over when the player balance goes to 0. |
||||||||||
Pre-conditions |
Player must have some money for play game. |
||||||||||
Post-conditions |
Player will lose all the money at the end. |
||||||||||
Notes: |
While playing the game if player lose all the money and his balance become 0 then game will stop. |
||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
||||||||||
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
4. |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
5. |
Dice rolled |
Lose the bet |
P |
|
|||||||
6. |
Result |
Player balance 0 and Game over. |
P |
|
|||||||
Test Data Table |
|||||||||||
|
1 |
2 |
3 |
4 |
5 |
||||||
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
Balance |
25(after win) |
$ 20 (after lose) |
$ 20(after win) |
$10 (after lose) |
$5 (after lose) |
||||||
When player wins on 1 match, balance does not increase.
Test Name |
Increment balance. |
||||||||||
Use Case Tested: |
Main.java |
||||||||||
Test Description: |
Increase player’s balance when wins the match. |
||||||||||
Pre-conditions |
Player must win the match. |
||||||||||
Post-conditions |
Player balance increases. |
||||||||||
Notes: |
According to rule while playing the game if player win the match then his balance increases but in this scenario when player wins his balance does not increase. |
||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
||||||||||
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
1 |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
2 |
Dice rolled |
Win the bet |
P |
|
|||||||
3 |
Result |
Player balance increase by $ 10. |
|
F |
|||||||
Test Data Table |
|||||||||||
|
1 |
2 |
3 |
4 |
5 |
||||||
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
Balance |
25(after win) |
$ 20 (after lose) |
$ 20(after win) |
$20 (after Win) |
$10 (after lose) |
||||||
Method |
Parameters |
Mutates |
Returns |
Constructor |
Int player |
Sets player’s name, age and balance. |
Objects reference. |
Main |
Int arguments |
Init main program |
int |
Winnings |
Int win |
Calculate the total winnings of palyer. |
int |
Buggy Code screen shot
Origin
Buggy Output
Code after eradicated bug
Out Put after eradicated bug
Test Name |
Increment balance. |
||||||||||
Use Case Tested: |
Main.java |
||||||||||
Test Description: |
Increase player’s balance when wins the match. |
||||||||||
Pre-conditions |
Player must win the match. |
||||||||||
Post-conditions |
Player balance increases. |
||||||||||
Notes: |
According to rule while playing the game if player win the match then his balance increases but in this scenario when player wins his balance does not increase. |
||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
||||||||||
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
7. |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
8. |
Dice rolled |
Win the bet |
P |
|
|||||||
9. |
Result |
Player balance increase by $ 10. |
P |
|
|||||||
Test Data Table |
|||||||||||
|
1 |
2 |
3 |
4 |
5 |
||||||
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
Balance |
20(after lose) |
$ 25 (after win) |
$ 15(after lose) |
$10 (after lose) |
$15 (after win) |
||||||
Bug 3. Odds in the game do not appear to be correct.
Test Name |
Sets Odds. |
||||||||||
Use Case Tested: |
Main.java |
||||||||||
Test Description: |
Remove the bias from game. |
||||||||||
Pre-conditions |
Player must play the match. |
||||||||||
Post-conditions |
The ratio should be approximately 0.42. |
||||||||||
Notes: |
In this game 8% bias is given to house. |
||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
||||||||||
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
1 |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
2 |
Dice rolled |
Win the bet |
P |
|
|||||||
3 |
Result |
Player balance increase by $ 10. |
P |
|
|||||||
4 |
Game End |
Ratio is less then or equals to 0.42 |
|
F |
|||||||
Test Data Table |
|||||||||||
|
1 |
2 |
3 |
4 |
5 |
||||||
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
Balance |
25(after win) |
$ 20 (after lose) |
$ 25 (after win) |
$30 (after Win) |
$25 (after lose) |
||||||
Method |
Parameters |
Mutates |
Returns |
Constructor |
Int player |
Sets player’s name, age and balance. |
Objects reference. |
Main |
Int arguments |
Init main program |
int |
Winnings |
Int win |
Calculate the total winnings of palyer. |
int |
Buggy Code
Buggy Output
Ratio is 0.60
Code after bug fixing
Output after bug fixing
Ratio is less than 0.42
BUG – 4
Test Name |
Sets Balance limit |
||||||||||
Use Case Tested: |
Main.java |
||||||||||
Test Description: |
In while condition compare player balance with 200 instead of 100 |
||||||||||
Pre-conditions |
Player must have balance $100 |
||||||||||
Post-conditions |
Sets the limit 100 |
||||||||||
Notes: |
According to game player has balance $ 100 but in main class checks the condition when playerbalnce < 200. |
||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
||||||||||
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
1 |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
2 |
Dice rolled |
Win the bet |
P |
|
|||||||
3 |
Result |
Player balance increase by $ 10. |
P |
|
|||||||
Test Data Table |
|||||||||||
|
1 |
2 |
3 |
4 |
5 |
||||||
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
Balance |
20(after lose) |
$ 25 (after win) |
$ 15(after lose) |
$10 (after lose) |
$15 (after win) |
||||||
Method |
Parameters |
Mutates |
Returns |
Constructor |
Int player |
Sets player’s name, age and balance. |
Objects reference. |
Main |
Int arguments |
Init main program |
int |
Winnings |
Int win |
Calculate the total winnings of palyer. |
int |
Buggy Code
Buggy output
Code after bug fixing
5. Bug
If player age is less than 18 then throw exception message.
Test Name |
Set AGE of player |
|||||||||||
Use Case Tested: |
Player.java |
|||||||||||
Test Description: |
Program will show error message if age of player is less than 18 yeras. |
|||||||||||
Pre-conditions |
Player must try to play game. |
|||||||||||
Post-conditions |
Player age is greater than 18 years |
|||||||||||
Notes: |
According to rule only player greater than age of 18 can play this game. |
|||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
|||||||||||
|
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
|
1 |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
|
1 |
Get name |
Accept name of player |
P |
|
|||||||
|
2 |
Get Balance |
Set balance $100 |
P |
|
|||||||
|
3 |
Get Age |
Accept age of player. |
|
F |
|||||||
|
Test Data Table |
|||||||||||
|
|
1 |
2 |
3 |
4 |
5 |
||||||
|
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
|
Age |
19 |
19 |
19 |
19 |
19 |
||||||
|
|
|
|
|
|
|
||||||
Method |
Parameters |
Mutates |
Returns |
Constructor |
Int player |
Sets player’s name, age and balance. |
Objects reference. |
Main |
Int arguments |
Init main program |
int |
Winnings |
Int win |
Calculate the total winnings of player. |
int |
Buggy Code
Code after bug fixing
Test Name |
Set AGE of player |
|||||||||||
Use Case Tested: |
Player.java |
|||||||||||
Test Description: |
Program will show error message if age of player is less than 18 yeras. |
|||||||||||
Pre-conditions |
Player must try to play game. |
|||||||||||
Post-conditions |
Player age is greater than 18 years |
|||||||||||
Notes: |
According to rule only player greater than age of 18 can play this game. |
|||||||||||
Result (Pass/Fail/Warning/Incomplete) |
|
|||||||||||
|
|
TEST STEP |
EXPECTED TEST RESULTS |
P |
F |
|||||||
|
1 |
Set bet on ‘ Anchor’ |
Set bit of $ 5 |
P |
|
|||||||
|
1 |
Get name |
Accept name of player |
P |
|
|||||||
|
2 |
Get Balance |
Set balance $100 |
P |
|
|||||||
|
3 |
Get Age |
Accept age of player. |
F |
|
|||||||
|
Test Data Table |
|||||||||||
|
|
1 |
2 |
3 |
4 |
5 |
||||||
|
Player Name |
Fred |
Fred |
Fred |
Fred |
Fred |
||||||
|
Age |
17 |
17 |
17 |
17 |
17 |
||||||