Creating Test Cases From Paths


Here's how to create a test case from a single TFD path. The subject of this example is again the Ammo TFD in Figure 11.13. The test case will test getting ammo, then getting the gun, and then exiting. This is path 1, 11, 12, 13. To describe this test case, use data dictionary definitions provided earlier in this chapter for the Unreal Tournament Bio-Rifle weapon.

Start constructing the test case with the data dictionary text for the IN box followed by the text for flow 1, which is the Enter flow:

Launch Unreal Tournament 2004 on the test PC.

Select a match and click the FIRE button to start the match.

Now add the text from the data dictionary for the NoGunNoAmmo state:

q ‚   ‚  

Check that the Bio-Rifle icon is empty in the graphical weapon inventory at the bottom of the screen

q ‚   ‚  

Check that the Bio-Rifle barrel is not rendered in front of your character

q ‚   ‚  

Check that you cannot select the Bio-Rifle weapon using the mouse wheel

Now take flow11 to get the Bio-Rifle ammo. Use the data dictionary entries for both the GetAmmo event and the AmmoEffects action:

Find a Bio-Rifle ammo pack on the floor in the arena and walk over it.

q ‚   ‚  

Check that the Bio-Rifle ammo sound is made

Flow 11 goes to the HaveAmmo state, so paste the HaveAmmo data dictionary text into the test case right after the text for flow 11:

q ‚   ‚  

Check that the Bio-Rifle icon is empty in the graphical weapon inventory at the bottom of the screen

q ‚   ‚  

Check that the Bio-Rifle barrel is not rendered in front of your character

q ‚   ‚  

Check that you cannot select the Bio-Rifle weapon using the mouse wheel

q ‚   ‚  

Check that the aiming reticle in the center of the screen has not changed

Next add the text for the GetGun event and GunEffects action along flow 12:

Find an unloaded Bio-Rifle hovering above the floor of the arena and walk into it.

q ‚   ‚  

Check that the Bio-Rifle sound is made

q ‚   ‚  

Check that the game temporarily displays "You got the Bio-Rifle" in white text above the gun icons at the bottom of the screen

q ‚   ‚  

Check that the game simultaneously displays "Bio-Rifle" temporarily in blue text above the "You got the Bio-Rifle" message

q ‚   ‚  

Check that all temporary text on the display fades out slowly

Then paste the definition of the HaveGunHaveAmmo state:

q ‚   ‚  

Check that the Bio-Rifle icon is present in the graphical weapon inventory at the bottom of the screen

q ‚   ‚  

Check that the Bio-Rifle barrel is rendered in front of your character

q ‚   ‚  

Check that you can select the Bio-Rifle weapon using the mouse wheel

q ‚   ‚  

Check that the Bio-Rifle aiming reticle appears as a small blue broken triangle in the center of the screen

q ‚   ‚  

Check that the ammunition count in the right-hand corner of the screen is 40

Flow 13 is the last flow on the path. It is the Exit flow, which goes to OUT_GunAmmo . Complete the test case by adding the text for these two elements:

Hit the ESC key and exit the match.

At the main menu, click "EXIT UT2004" to exit the game.

That's it! Here's how all of the steps look when they're put together:

Launch Unreal Tournament 2004 on the test PC.

Select a match and click the FIRE button to start the match.

q ‚   ‚  

Check that the Bio-Rifle icon is empty in the graphical weapon inventory at the bottom of the screen

q ‚   ‚  

Check that the Bio-Rifle barrel is not rendered in front of your character

q ‚   ‚  

Check that you cannot select the Bio-Rifle weapon using the mouse wheel

Find a Bio-Rifle ammo pack on the floor in the arena and walk over it.

q ‚   ‚  

Check that the Bio-Rifle ammo sound is made

q ‚   ‚  

Check that the Bio-Rifle icon is empty in the graphical weapon inventory at the bottom of the screen

q ‚   ‚  

Check that the Bio-Rifle barrel is not rendered in front of your character

q ‚   ‚  

Check that you cannot select the Bio-Rifle weapon using the mouse wheel

q ‚   ‚  

Check that the aiming reticle in the center of the screen has not changed

Find an unloaded Bio-Rifle hovering above the floor of the arena and walk into it.

q ‚   ‚  

Check that the Bio-Rifle sound is made

q ‚   ‚  

Check that the game temporarily displays "You got the Bio-Rifle" in white text above the gun icons at the bottom of the screen

q ‚   ‚  

Check that the game simultaneously displays "Bio-Rifle" temporarily in blue text above the "You got the Bio-Rifle" message

q ‚   ‚  

Check that all temporary text on the display fades out slowly

q ‚   ‚  

Check that the Bio-Rifle icon is present in the graphical weapon inventory at the bottom of the screen

q ‚   ‚  

Check that the Bio-Rifle barrel is rendered in front of your character

q ‚   ‚  

Check that you can select the Bio-Rifle weapon using the mouse wheel

q ‚   ‚  

Check that the Bio-Rifle aiming reticle appears as a small blue broken triangle in the center of the screen

q ‚   ‚  

Check that the ammunition count in the right-hand corner of the screen is 40

Hit the ESC key and exit the match.

At the main menu, click "EXIT UT2004" to exit the game.

You can see how indenting the action and state definitions makes it easy to distinguish tester operations from things you want the tester to check for. When something goes wrong during this test you will be able to document the steps that led up to the problem and what specifically was different from what you expected.

There are two techniques you can use to reuse this test case for another type of weapon. One is to copy the Bio-Rifle version and substitute the name of another weapon and its ammo type for "Bio-Rifle" and "Bio-Rifle ammo." This only works if all of the other details in the events, flows, and states are the same except for the gun and ammo names .

In this case, Bio-Rifle-specific details were put into some of the definitions in order to give a precise description of what the tester should check.

GunEffects contains the following check, which references text color that varies by weapon. It is blue for the Bio-Rifle but different for other weapons, such as red for the Rocket Launcher and white for the Minigun.

q ‚   ‚  

Check that the game simultaneously displays "Bio-Rifle" temporarily in blue text above the "You got the Bio-Rifle" message

Likewise, the HaveGunHaveAmmo state describes a specific color and shape for the Bio-Rifle aiming reticle as well as an ammunition count. Both vary by weapon type.

q ‚   ‚  

Check that the Bio-Rifle aiming reticle appears as a small blue broken triangle in the center of the screen

q ‚   ‚  

Check that the ammunition count in the right-hand corner of the screen is 40

This leaves you with the option to copy the Bio-Rifle data dictionary files into a separate directory for the new weapon. These files should then be edited to reflect the details for the new weapon type you want to test. Use those files to construct your test cases for the new weapon in the same you did for the Bio-Rifle.

Remember that using text in the data dictionary is not your only option. You can also use screen shots or automated code. When executable code for each TFD element along a test path is pasted together, you should end up with an executable test case. Use the IN definition to provide introductory code elements such as including header files, declaring data types, and providing main routine opening braces. Use the OUT definition to perform cleanup actions such as freeing up memory, erasing temporary files, and providing closing braces.

Storing data dictionary information in separate files is also not your only option. You could keep them in a database and use a query to assemble the "records" for each TFD element into a report. The report could then be used for manual execution of the game test.




Game Testing All in One
Game Testing All in One (Game Development Series)
ISBN: 1592003737
EAN: 2147483647
Year: 2005
Pages: 205

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net