Test Cases

Test Cases Harry Potter Jeopardy

Assignment Description: 

The program has preset questions, and depending on which question the user chooses, it will ask the user to answer questions. It will compare it to the real answer, and display the correct answer to the user. 

Test Case #1

Designed by: Natalie Chin
Executed by: Natalie Chin

Test Case Name: Invalid Entries

Short Description: Tests to see whether the program handles user input correctly 

Preconditions: The user has selected a program, and has entered nothing in the answer field. 


Steps
Action and Data
Expected Output
Pass/Fail
Comments
1
Select character 777 question. 
Displays the question that corresponds to the one that user chose. 
Pass
Worked the way I wanted it to. 
2
Enter nothing in the text field - just press the continue button. 
Displays a JOptionPane asking the user to enter a valid value. 
Fail
Didn’t work as I anticipated because the JFrame with the question closed before we were even done using it! 
3
Enter nothing in the JOptionPane and press the “ok” button
Displays the JOptionPane again, asking for the user’s input. 
Fail
As said before, the question disapparated before the user could see it. So I edited it to show the question (using the toString method I wrote). 
4
Answer the question correctly
After pressing ‘ok,’ the button should turn grey so that you cannot answer it again. 
Pass 
It works as expected. 
5
Click the Characters 777 again. 
The user should not be able to answer it again. If it is clicked, it should display a JOptionPane saying that you are not allowed to answer the same question twice. 
Pass 
It works as is expected - displaying a JOptionPane 


Post Conditions: The user loses 777 points. 

Input: Nothing/nothing/nothing

Output: Displays the question frame which contains the question that corresponds with the button that user clicked/displays the following input frame/displays the input pane again. 

What I fixed: I went back to all the if statements about which question was answered, and I ended up adding the question into the JOptionPane. 

Test Case #2

Designed by: Natalie Chin
Executed by: Natalie Chin

Test Case Name: White Space 

Short Description: Tests to see whether the program handles user white space correctly or not. 

Preconditions: The user has selected a question, and has typed a bunch of spaces


Steps
Action and Data
Expected Output
Pass/Fail
Comments
1
Select character 77 question. 
Displays the question that corresponds to the one that user chose. 
Pass
Worked the way I wanted it to. 
2
Enter 10 blank spaces in the answer section. 
Marks the answer as incorrect
Pass
I was thinking that the person who is playing the program - if he or she has entered 10 spaces, is probably because he or she does not know the answer or is just trying to play around. 
3
Can the user press the same question again? 
Displays a JOptionPane that does not allow the user to reanswer the question. 
Pass 
You cannot press it again. 


Post Conditions: The user loses 777 points. 

Input: Blank Space

Output: Displays the question frame which contains the question that corresponds with the button that user clicked. 

What I fixed: Nothing. 

Test Case #3

Designed by: Natalie Chin
Executed by: Natalie Chin

Test Case Name: Score

Short Description: Tests to see whether the program handles the score correctly

Preconditions: Assuming that these are the first questions that the user has answered. 


Steps
Action and Data
Expected Output
Pass/Fail
Comments
1
Select House #97 
The question frame popping up. 
Pass
It pops up
2
Answer the question correctly 
J.O.P (JOptionPane) pops up saying that the user got the question correct. 
Pass
Yes, the question frame disappears and the new pictures shows up. 
3
Select Spells 297
Question frame popping up in that specific colour
Pass 
It pops up and the colour corresponds correctly
4
Answer the question correctly 
J.O.P pops up saying the user answered the question correctly
Pass 
Displays the score and an adequate message. 


Post Conditions: The user gains 394 points!

Input: Gryffindor/Sectumsempra: for enemies

Output: Displays the question frame and then a congratulatory message and then the same thing again. 

What I fixed: Nothing, it all worked. 

Test Case #4

Designed by: Natalie Chin
Executed by: Natalie Chin

Test Case Name: High Scores

Short Description: Tests to see whether the program handles high scores well

Preconditions: The user has gained a score higher than the lowest high score in the program, therefore, adding the user’s score and name to the highScores frame. 


Steps
Action and Data
Expected Output
Pass/Fail
Comments
1
Select character 777 question. 
Displays the question that corresponds to the one that user chose. 
Pass
Worked the way I wanted it to. 
2
Answer the question
Displays a JOptionPane telling you that you answered it correctly. 
Pass
It did just that! 
3
Select Actors 777 question
Displays the question that corresponds to the one that user chose. 
Pass 
Worked the way I wanted it to. 
4
Answer the question
Displays a JOptionPane telling you that you answered it correctly. 
Pass 
It was correct
5
Press the X button on the top
Ask for user’s name to add to high scores
Pass 
Works just the way I wanted it to 
6
Enters name in the J.O.P and presses ‘ok’ 
Displays a list of people and their high scores in the program. 
Pass 
The colours are all right on! 


Post Conditions: The user loses 777 points. 

Input: Percival Dumbledore/Jade Oliver Gordon

Output: Displays the question frame which contains the question that corresponds with the button that user clicked, then a JOptionPane to tell the user that they have answered it correctly. 

What I fixed: Nothing. 

Test Case #5

Designed by: Natalie Chin
Executed by: Natalie Chin

Test Case Name: I died. 

Short Description: Tests to see whether the program handles a score less than 0 correctly. 

Preconditions: The user has just started the program. 


Steps
Action and Data
Expected Output
Pass/Fail
Comments
1
Select Beedle and the Bard 777 knut question. 
Displays the question that corresponds to the one that user chose. 
Pass
Worked the way I wanted it to. 
2
Answer it wrong. 
Marks the answer as incorrect
Pass
Uses a JOptionPane to show that the user entered the incorrect answer. 
3
Select the Houses 777 knut question 
Displays the question that corresponds to the one that user chose. 
Pass 
It popped up just the way I wanted it to, and it corresponded to the right colours. 
4
Answer it wrong. 
Marks the answer as incorrect 
Pass 
Perfect!
5

Joptionpane pops up saying that the user has died. 
Pass! 
Works just as expected!


Post Conditions: The user died. 

Input: ljkajflskdfj/lasjldkfjks

Output: Displays the question frame which contains the question that corresponds with the button that user clicked. Upon entering the wrong input, there is a JOptionPane that pops up and tells the user that they have answered it incorrectly. 


What I fixed: Nothing. 

No comments:

Post a Comment