unit testing level game. create pieces array call move or interact use getters or return type to...
TRANSCRIPT
Unit TestingLEVEL GAME
Create pieces arrayCall move or interactUse getters or return type to verify correct behavior
Test ends (don’t go <0 or >GameEngine.BOARD_SIZE-1)
If interact with adjoining piece, put that piece & yours on board
If interact within range, be sure to test locations within range PLUS one beyond
TEST INDIVIDUAL PIECES
Can’t test random behavior deterministicallyNeed to run method multiple times
Do all possible results actually occur? Do the possible results account for ALL results? (i.e., no
invalid moves)What if LOTS of valid results? (e.g., any location)
Test ends Identify “categories” of possibilities
If limited number of possibilities, test each one E.g., move one to right or left
TEST RANDOM MOVEMENT
What if the player is within “range” of more than one piece?
We’re not testing this, but the approach would be: Create a GameEngine Create a pieces array Add a setter to GameEngine for the pieces array Call interaction
TEST INTERACTION
BLACK BOX VS WHITE BOX
Criteria Black Box Testing White Box Testing
Definition
Black Box Testing is a software testing method in which the internal structure/ design/ implementation of the item being tested is NOT known to the tester
White Box Testing is a software testing method in which the internal structure/ design/ implementation of the item being tested is known to the tester.
Levels Applicable To
Mainly applicable to higher levels of testing:Acceptance TestingSystem Testing
Mainly applicable to lower levels of testing:Unit TestingIntegration Testing
Responsibility Generally, independent Software Testers
Generally, Software Developers
Programming Knowledge Not Required Required
Implementation Knowledge Not Required Required
Basis for Test Cases Requirement Specifications Detail Design
From: http://softwaretestingfundamentals.com/differences-between-black-box-testing-and-white-box-testing/
Analyze control flow graphFind linearly independent paths of executionGuarantees complete branch coverageDoes not cover all possible paths
http://www.tutorialspoint.com/software_testing_dict ionary/basis_path_testing.htm
http://users.csc.calpoly.edu/~jdalbey/206/Lectures/basispathEg.html
BASIS PATH TESTING (WHITE BOX)
Method to test all the possible discrete combinations of the parameters involved.
http://www.tutorialspoint.com/software_testing_dict ionary/al l_pairs_testing.htm
ALL PAIRS TESTING