-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.txt
518 lines (479 loc) · 29.2 KB
/
testing.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
Black-box testing
Test Menu Screen
Test interactivity of pictures
Tap/LongPress/Pan on Bubble Blast Saga Logo: Nothing should happen.
Tap/LongPress/Pan on Tag Line picture: Nothing should happen.
Test buttons
Test Play
Tap on Play: Button text turns gray. Should show Level Selection screen.
Long press on Play: Button text turns gray. Should show Level Selection screen on release.
Pan on Play: Should be similar to long press, unless pan is released without being on the button, in which case nothing happens.
Test Design
Tap/Long press/Pan behavior similar to play button. Should show Level Design screen instead.
Test Settings
Tap/Long press/Pan behavior similar to play button. Sould show Settings screen instead.
Test Settings
Test interactivity of text labels
All text labels should not be interactive, except for the easy, medium hard buttons which are not text labels but might be confused for them.
Test Limited Cannon Shots Mode switch
Should toggle on press.
Test Limited Time Mode Switch
Should toggle on press.
Test buttons
Should show white border on selected button, rest of the 2 buttons on the same row should not have a border
Notation:
Let Limited Cannon Shots Mode = LCM, its associated difficulty be e, m, h with regards to easy medium hard respectively.
Let Limited Time Mode = LTM, its associated difficulty be e, m, h with regards to easy medium hard respectively.
Test gameplay with regards to settings
Test LCM off(e) LTM off(e): Should be unlimited shots and time.
Test LCM on(e) LTM off(e): Should have 120 cannon shots and unlimited time.
Test LCM off(e) LTM on(e): Should have unlimited shots and 60 seconds.
Test LCM on(e) LTM on(e): Should have 120 cannon shots and 60 seconds.
Test LCM off(m) LTM off(m): Should be normal gameplay mode.
Test LCM on(m) LTM off(m): Should have 80 shots.
Test LCM off(m) LTM on(m): Should have 40 seconds.
Test LCM on(m) LTM on(m): Should have 80 shots and 40 seconds
Test LCM off(h) LTM off(h): Should be normal gameplay mode.
Test LCM on(h) LTM off(h): Should have 40 shots.
Test LCM off(h) LTM on(h): Should have 20 seconds.
Test LCM on(h) LTM on(h): Should have 40 shots and 20 seconds.
Test combination of different difficulty levels as well:
(For each state (on, on), permute (off, off), (off, on), (on, off) as well. Every off should make the associated mode normal (untimed or unlimited shots))
Test LCM on(e) LTM on(m): 120 shots, 40 seconds
Test LCM on(e) LTM on(h): 120 shots, 20 seconds
Test LCM on(m) LTM on(e): 80 shots, 60 seconds
Test LCM on(m) LTM on(h): 80 shots, 20 seconds
Test LCM on(h) LTM on(e): 40 shots, 60 seconds
Test LCM on(h) LTM on(m): 40 shots, 40 seconds
Test settings remain after going back to main menu:
Test for each permutation above. Settings should remain as they were.
Test reload app: Settings should go back to default state: LCM off(e) LTM off(e)
Test Level Selection Screen
Segued From Main Menu:
Test Level Preview:
Should be able to show the picture of the level.
After resaving under same name: Picture should update to show the change.
Test interactivity of "Level selection text label": should not be interactive
Test Buttons
Test Back button: Should unwind to main menu.
Test Delete button: Should put into delete mode. Text label changed to red and shows deletion warning. Delete button text changes to Confirm, red.
Test Tap on level in normal mode: Should start the level.
Test Tap on level in delete mode: Should mark the level with a red border.
Test Delete confirm functionality
No Levels marked for deletion: Nothing happens, goes back into normal mode.
1 level marked for deletion: That level deleted.
2 levels marked for deletion: Two levels Deleted.
All levels marked for deletion: All levels deleted.
Test delete persistency:
After deletion, restart app and ensure deleted levels are not there.
Segued From Level Designer:
Test Level Preview:
Should be able to show the picture of the level.
After resaving under same name: Picture should update to show the change.
Test interactivity of "Level selection text label": should not be interactive
Test Buttons
Test Back button: Should unwind to level designer.
Test Delete button: Should put into delete mode. Text label changed to red and shows deletion warning. Delete button text changes to Confirm, red.
Test Tap on level in normal mode: Should load the level. Level should be editable in level design mode, and playable upon start button push.
Test Tap on level in delete mode: Should mark the level with a red border.
Test Delete confirm functionality
No Levels marked for deletion: Nothing happens, goes back into normal mode.
1 level marked for deletion: That level deleted.
2 levels marked for deletion: Two levels Deleted.
All levels marked for deletion: All levels deleted.
Test delete persistency:
After deletion, restart app and ensure deleted levels are not there.
Test Preloaded Levels
Delete preloaded levels: They should reappear when app is relaunched.
Load and modify preloaded levels: Should be able to update it by saving under same name.
Test Level Design Screen
Test implementation of buttons
Save button: should show save alert.
Load button: should segue to level selection screen.
Start button:
Empty grid: game starts, default win.
One normal bubble connected to top wall in grid: game starts
One special bubble e.g. bomb connected to top wall in level: game starts, default win.
Bubbles not connected to top: Should dissappear upon game start.
Reset button:
Empty grid: should show reset alert. Upon confirmation, should show that level is already empty.
Non-empty grid: should show reset alert. Game grid should be reset only upon confirmation.
Back button:
Should unwind to main menu.
Grid should be empty after coming back from main menu.
Test implementation of file operations
Save (make changes between each step to distinguish)
Test level name validity
Empty level name: Should show level name not valid message.
One whitespace name: Should show level name not valid message.
25 whitespace name: Should show level name not valid message.
One character (non-whitespace): Should show level saved.
25 characters (at least one non-whitespace): Should show level saved.
26 characters (at least one non-whitespace) : Should show level name not valid.
Test saving
Press cancel on save alert: level should not be saved.
Press confirm on save alert with level name "test": level should be saved, verify by resetting, then loading.
Press confirm on save alert with level name "test": level should be updated, verify by loading.
Press confirm on save alert with new level name "test2": level saved, verify by erasing, then loading.
Load
Load a few saved levels: levels should be loaded successfully. grid contents should be replaced by loaded level contents.
Save after loading under same name: Level should be updated with new contents.
Save after loading with different name: level should be saved under different name
Restart the app: previously saved levels can still be loaded.
Test implementation of game grid
Tap a grid cell
No palette item selected:
Empty cell: Nothing happens
Non-empty cell: Cell color cycles in order with palette items
Non-erase item selected e.g Red
Empty cell: Cell filled with red
Non-empty cell: Cell color cycles in order with the palette items
Erase selected:
Empty cell: Nothing happens
Non-empty cell: Cell becomes empty
Drag to fill the grid cells
No palette item selected: Nothing happens
Non-erase item selected e.g. Blue
Empty cell: Cell filled with blue
Non-empty but not blue cell: Cell color changed to blue
Blue cell: Nothing happens
Erase selected:
Empty cell: Nothing happens
Non-empty cell: Cell becomes empty
Long press on grid cell
No palette item selected:
Empty cell: Nothing happens
Non-empty cell: Cell becomes empty
Non-erase item selected e.g. Blue
Empty cell: Nothing happens
Non-empty but not blue cell: Cell becomes empty
Blue cell: Cell becomes empty
Erase selected:
Empty cell: Nothing happens
Non-empty cell: Cell becomes empty
Dragging after long press:
Nothing should happen.
Test implementation of palette buttons
For each palette button,
Test animations:
Should animate and marked with black border upon selection.
Test functionality:
Should apply the right color to an empty grid cell, and do the appropriate response to a non empty depending on gesture type. (Can test every one of such item using the "Implementation of game grid" above.)
Test overall cycle animation:
Should animate in order of currently cycled bubble
Test longpress animation:
Erase bubble should be animated.
Test implementation of user feedback
Press save and then cancel the alert: should show "SAVING CANCELLED!"
Press save and then click confirm without filling in level name: should show "LEVEL NAME IS NOT VALID!"
Press save with a level name more than 25 characters: should show "LEVEL NAME IS NOT VALID!"
Press save and then successfully save a game by filling in non-whitespace name less than or equal to 25 characters: should show "LEVEL SAVED!"
Press reset and confirm:
if game grid is not empty, should show "LEVEL RESET!"
if game grid is empty, shoudl show "LEVEL IS ALREADY EMPTY!"
Test GamePlay Screen
Test buttons
Test Back Button:
Segued from Level Designer: Should unwind to Level Designer
Segued from Level Selection: Should unwind to Level Selection
Test Retry Button:
Test when game is started:
Should restart the level.
Score: Should be set to zero
Timed Mode: Counter should reset to max time.
Limited Shots Mode: Counter should reset to max shots
Test when game is ongoing:
Should restart the level.
Score: Should be set to zero
Timed Mode: Counter should reset to max time.
Limited Shots Mode: Counter should reset to max shots
Test when game is ended:
Should restart the level, clear the end game screen.
Score: Should be set to zero
Timed Mode: Counter should reset to max time.
Limited Shots Mode: Counter should reset to max shots
Test projectile firing
Test Tap
Tap on screen in firing angle range: Projectile should fire in direction of tap location.
Tap on screen outside firing angle range: Projectile should not fire.
Test Pan
Pan on screen: Projectile should fire in direction of the last pan location before lifting finger. Unless this last pan location is outside firing angle range, then it should not fire.
Test Long Press
Long press on screen in firing angle range: Projectile should fire in direction of tap location upon release.
Long press on screen outside firing angle range: Projectile should not fire.
Test cannon:
Test rotations
Tap
Cannon should rotate to face tap location direction.
Pan & release
Cannon should rotate and face user's panning location until user's finger is released. If user goes out of cannon firing angle range, cannon should stop following user.
Test animations
Firing animation: Should display firing animation upon every shot fired. Next projectile should be loaded into cannon, if any.
Test next projectile:
Should be set up at start of game.
Should set up a new next projectile after every shot.
Should not collide with any bubbles falling down.
Should be of a color that is in the game grid.
Test projectile movement
Test single projectile:
Fire the projectile. It should travel at a constant speed until collision.
Test multiple projectiles:
Should be able to fire the projectile when another projectile is still moving. Projectiles collided should bounce off each other realistically.
Test projectile collision
Test collision between projectile and a screen edge
Test projectile collision with right screen edge
Should bounce off right screen naturally and change its direction to left.
Test projectile collision with left screen edge
Should bounce off left screen naturally and change its direction to right.
Test projectile collision with top screen edge
Should snap to nearest empty cell in the grid.
Test projectile collision with bottom screen edge
Should disappear from the game
Test falling bubbles collision with bottom screen edge
Should disappear from the game
Test collision between two bubbles
Test collision between projectile and a stationary bubble in grid
Projectile should snap to nearest empty cell.
Exception: When projectile is shot at a bubble in the last row, and snap location is below white dashed line. Game will end.
Test collision between falling bubbles and stationary bubbles in grid: Nothing should happen.
Test collision between two projectiles: Should bounce off naturally, change direction naturally. Post collision, should be able to snap to grid, bounce off walls or collide with other projectiles in flight.
Test projectile post-snap to empty cell behavior
No neighbours: Nothing should happen
Neighbors of all different color from projectile: Nothing should happen
2 or more clusters(connected group of bubbles) of same color as projectile: The cluster of same color bubbles should pop. After they pop, bubbles not connected to the top wall should fall.
Test Special Bubbles:
Test activation priority:
When a bubble is newly snapped next to a star, lightning and bomb bubble, the priority should be star first, then lightning, then bomb. So the one that destroyed the star must be this newly snapped bubble
Following tests: Test by snapping a projectile next to the special bubble.
Test Lightning
Should be able to destroy all bubbles in same row as it, except indestructible bubble. Disconnected bubbles should fall after.
Test Bomb
Should be able to destroy all adjacent bubbles, except indestructible bubble. Disconnected bubbles should fall after.
Test Indestructible
Should not be popped in any way. Should be able to fall out the screen.
Test Star
Test normal bubble activates star: all normal bubbles of that type removed.
Test lightning activates star: all lightning bubbles should activate and remove bubbles in their row.
Test bomb activates star: all bomb bubbles should activate and remove bubbles adjacent to them.
Test animations:
Pop animation: Normal bubbles should pop when in cluster of three of more same color bubbles.
Falling animation: Unconnected bubbles should fall off the bottom part of the screen
Lighting animation: Should fill the row the lightning bubble is on when it is activated.
Bomb animation: Should have a circular explosion radius that covers its adjacent neighbours
Exceptions: Animations should not play for game winning shots.
Test Game win/lose conditions
Test Default Win:
The following conditions should trigger the default win screen:
Start a level with empty grid
Start a level without any normal bubbles, with any amount of special bubbles.
Start a level without any normal bubble that is connected to the top of grid in any way.
Test Time Out:
Let the timer run to 0 in timed mode. Should trigger Lose Game Screen.
Test No More Shots:
Let the shot count run to 0. Shoot again with count at 0. Should trigger no more shots screen.
Test Lose Game:
Fire shots of different color in a line until it reaches the white dashed line. Snapping past the white dashed line should trigger lose game screen.
Test Win Game:
Clear all normal colored bubbles from the grid. Should trigger win game screen.
Test Game Score
Game score should update itself throughout the game according to scoring system defined in Constants file.
At the game of game, game score multipliers and additions should be applied correctly.
Test End game screen
Should show the title: Win/Loss/Default win.
Should show win bonus x2 if game is won.
Should show number of shots fired and time taken.
Should show initial GamePlay score and Final Score.
In timed mode, should show time left and time bonus.
In limited shots mode, should show shots left and shows left bonus.
Glass-box testing
TestModelManager
TestInit:
Assert grid row and column same as specified in Constants.swift, assert every cell is empty
TestSetBubbleAt
Row not in grid: Nothing happens
Column not in grid: Nothing happens
Row and column in grid, BubbleType .empty, no bubble at location: Nothing happens
Row and column in grid, BubbleType .empty, bubble at location: The grid location is now empty.
Row and column in grid, BubbleType nonempty, no bubble at location: The normal bubble is now at the location
Row and column in grid, BubbleType nonempty, bubble at location: The bubble type at grid is replaced by the new one.
TestRemoveBubbleAt
Row not in grid: Nothing happens
Column not in grid: Nothing happens
Row and column in grid, no bubble at location: Nothing happens
Row and column in grid, bubble at location: bubble removed.
TestGetBubbleAt
Row not in grid: Should return nil
Column not in grid: Should return nil
Row and column in grid, no bubble at location: Should return nil
Row and column in grid, bubble at location: Should return the bubble.
TestResetGridState
Initially empty: Should be be empty after reset.
Initially non-empty: Should still be empty after reset.
TestBuildBubble
All types of bubbles in BubbleType
TestGetNeighborsOfBubble
Bubble not in grid: Should return nil
Bubble no neighbours: Should return empty array.
Check these edge cases: Should return the correct neighbours
Bubble in front of odd row
Bubble in back of odd row
Bubble in front of even row
Bubble in back of odd row
TestIsBubbleTypeInGrid
Zero of that bubble type in grid: Should return false
One or more of that bubble type in grid: Should return true
TestIsAnyNormalBubblesInGrid
One normal bubble in grid: Should return true
No normal bubbles in grid: Should return false
No bubbles in grid: Should return false
TestStorageManager
TestInit
Should load in prepackaged levels. If levels with same name already exists, should skip them.
TestSaveLevel
Should be able to save a level along with its associated image inside the documents directory, under the same fileName, with one being .pList and the other .png
TestLoadLevel
Should be able to load a level and its associated image from the documents directory based on fileName.
TestDeleteLevel
Should be able to delete any level and its associated image from the documents directory based on fileName.
TestGameViewController
TestFireCannon
Should animate cannon, update shots count, and update the text displayed if in limited shots mode.
TestUpdateGameScore
Param Score: Should be able to set gameScoreText's text to be the param score.
TestEndGame
Should stop the game
TestGetBubbleWidth
Should return the width of a bubble grid cell.
TestGetBubbleRadius
Should return the radius of a bubble grid cell.
TestGetCannonAreaPosition
Should return the position of the projectile in cannon.
TestGetNextProjectilePosition
Should return the positon of the next projectile.
TestGetBubbleRowAndCol
Bubble with position: Should return the correct row and col it is in.
Bubble without positon: Should trigger assertionFailure
TestGetBubbleIndexPath
Bubble with position: Should return the correct indexPath it is at.
Bubble without positon: Should trigger assertionFailure
TestRandomBubbleHelper
TestNextBubble
isAccountingForBubblesGenerated is false
noOfBubbles attribute is 0: Should return a bubble in the grid.
noOfBubbles attribute is non zero: Should return a bubble in the grid.
isAccountingForBubblesGenerated is true
noOfBubbles attribute is 0: Should return nil.
noOfBubbles attribute is non zero: Should return a bubble in the grid.
TestGameObject
testPosition
_position is nil
get: Should return nil
set: Should set _position to be the new position and post a notification.
_position is not nil
get: Should return _position
set: Should set _position to be the new position and post a notification.
testPhysicsBody
_physicsBody is nil
get: Should return nil
set with nil:
Nothing changes, _physicsBody still nil
set with not nil:
_physicsBody is set to this new value, physicsBody's physicsBodyOwner should be set up as this GameObject.
_physisBody is not nil
get: Should return _physicsBody
set with nil:
_physicsBody is now nil
set with not nil:
_physicsBody is set to this new value, physicsBody's physicsBodyOwner should be set up as this GameObject.
TestScene
testInit
should initialise gameObjects array to be empty and instantiate physicsWorld.
testAdd
should add the gameObject into gameObjects array.
testRemove
gameObject does not exist in gameObjects
Nothing should happen.
gameObject exists in gameObjects
Gameobject should be removed from gameObjects.
Notification should be posted.
The gameObjects array should remain the same except for this removed gameObject.
TestRenderer
testDraw
Should create UIImageViews for each gameObject in scene on the view. Should set them to be at the position of the gameObject.
testMoveImage
Image should be set as its new center to be the gameobject's position.
testRemoveImage
Image should be removed from its superview.
TestPhysicsWorld
testAdd
Should add the physicsBody into physicsBodies array.
testRemove
physicsBody does not exist in physicsBodies
Nothing should happen.
physicsBody exists in physicsBodies
physicsBody should be removed from physicsBodies.
The physicsBodies array should remain the same except for this removed physicsBody.
TestPhysicsBody
testPosition
get
physicsBodyOwner is nil
should return nil
physicsBodyOwner is not nil
should return position of physicsBodyOwner
set
physicsBodyOwner is nil
nothing should happen
physicsBodyOwner is not nil
should change position of physicsBodyOwner
testIsResting
velocity is 0.0 for both dx and dy: returns true
velocity is 0.0 for dx and non 0.0 for dy: returns false
velocity is not 0.0 for dx and 0.0 for dy: returns false
velocity is not 0.0 for both dx and dy: returns false
testInit
initCircle
Should set physicsBodyType to be a new Circle instance.
Center of circle should be this physicsBodyOwner's position.
Radius of circle should be set up correctly.
Should be in PhysicsWorld's physicsBodies array.
initEdgeLoop
Should set physicsBodyType to be a new EdgeLoop instance.
Size of edgeloop should be this size of param rect.
Origin of edgeloop should be origin of param rect.
Should be in PhysicsWorld's physicsBodies array.
TestTraversalHelper
testInit
Should initialise all function references correctly.
testClusterCheckTraversal
targetBubble not in grid:
Should trigger assertionFailure. Return nil.
no neighbours:
Should return empty array.
clusters of same color:
Should return all of same color clustered bubbles as a GameBubble array.
testAttachedCheckTraversal
No bubbles in grid
Should return empty set.
No bubbles in first row of grid
Should return empty set.
1 bubble in top row of grid
Should return all bubbles connected to this top bubble.
Fully packed grid:
Should return all bubbles in grid.
TestGameLevelScene
testInit: Should set up all components correctly.
testUpdate: Should integrate with game logic to handle newly snapped bubble correctly.
testInitialiseGame: Should initialise gameobjects from param gridState correctly.
testRemoveGameObjectFromScene: Should remove param gameObject from its parent gameObjects array.
TestGameLogic
testDelegateDidSet: Should call delegate's initialise game with modelManager's gridState. Should remove unattached bubbles.
testInit: Should set up components correctly.
testIsGameWon:
GameGrid is empty: Should return true
GameGrid has no normal bubbles: Should return true
GameGrid has one or more normal bubble: Should return false
testHandleNewlySnappedBubble:
Should work with TraversalHelper.
Test all types of neighbors: Should work with the define behavior given in README.md.
testAddToGameBubbleModel: Should work with ModelManager to add a new bubble to the grid.
testRemoveFromGameBubbleGridModel: Should work with ModelManager to remove a bubble from the grid.