13. Quality Assurance & Testing

Defold Platformer Framework
# 13. Quality Assurance & Testing Quality assurance and testing are crucial components of game development that ensure your platformer is stable, performs well, and provides an enjoyable experience for players. This section covers various testing approaches and quality assurance practices specific to the Defold Platformer Framework. ## Table of Contents - [Testing Fundamentals](#testing-fundamentals) - [Automated Testing](#automated-testing) - [Manual Testing](#manual-testing) - [Performance Testing](#performance-testing) - [Compatibility Testing](#compatibility-testing) - [Bug Tracking and Management](#bug-tracking-and-management) - [Pre-Release Checklist](#pre-release-checklist) ## Testing Fundamentals Testing should be integrated throughout your development process rather than left until the end. The earlier you catch issues, the easier and less expensive they are to fix. ### Types of Testing for Platformers 1. **Functional Testing**: Verifies that game mechanics work as expected 2. **Balance Testing**: Ensures difficulty progression is appropriate 3. **Performance Testing**: Checks frame rates, memory usage, etc. 4. **Usability Testing**: Evaluates player experience and controls 5. **Compatibility Testing**: Ensures the game works across platforms ## Automated Testing Automated tests can save significant time by catching regressions and issues early. ### Unit Testing in Defold Defold supports automated testing through its test modules. Here's a basic example of a test for a player's jump function: ```lua -- test_player_jump.lua local test = require "defold-unittest.test" function test_jump_height(self) local player = require "main.player" local initial_y = player.position.y player.jump() -- Wait for jump to reach peak timer.delay(0.5, false, function() local peak_y = player.position.y test.assert_gt(peak_y, initial_y) end) end ``` ### Integration Testing For testing how components work together: ```lua function test_player_enemy_collision(self) local player = require "main.player" local enemy = require "main.enemy" -- Position player and enemy to collide player.position = vmath.vector3(100, 100, 0) enemy.position = vmath.vector3(100, 100, 0) -- Update game state update_world(1/60) -- Check player took damage test.assert_lt(player.health, player.max_health) end ``` ### CI/CD Pipeline Consider setting up a continuous integration pipeline that runs tests automatically when you push changes. GitHub Actions, Jenkins, or CircleCI can be configured to work with Defold projects. ## Manual Testing While automated tests are valuable, manual testing remains essential for platformers. ### Playtesting Guidelines 1. **Regular Sessions**: Schedule weekly playtesting sessions 2. **Diverse Testers**: Include both experienced gamers and newcomers 3. **Specific Scenarios**: Test edge cases like: - Jumping at the exact edge of platforms - Rapid input combinations - Collision edge cases ### Playtesting Focus Areas For platformers, pay special attention to: - **Controls responsiveness**: Do jumps, moves, and attacks feel tight? - **Platform collisions**: Any cases where the player falls through or gets stuck? - **Camera behavior**: Does it follow smoothly without causing disorientation? - **Difficulty progression**: Is the learning curve appropriate? ### Playtesting Feedback Form Create a structured form for playtesters that includes questions like: - On a scale of 1-5, how responsive did the controls feel? - Did you encounter any areas where you got stuck? - Was the difficulty appropriate at each stage? - Did you notice any visual glitches or performance issues? ## Performance Testing Platformers need to maintain consistent frame rates for responsive controls. ### FPS Monitoring Add an FPS counter during development: ```lua function update(self, dt) -- Calculate FPS self.frame_count = (self.frame_count or 0) + 1 self.time_passed = (self.time_passed or 0) + dt if self.time_passed >= 1 then self.fps = self.frame_count / self.time_passed self.frame_count = 0 self.time_passed = 0 print("FPS: " .. math.floor(self.fps)) end end ``` ### Memory Profiling Use Defold's built-in profiler to monitor memory usage: ```lua function init(self) profiler.enable_ui(true) end ``` ### Performance Optimization Checklist - Implement object pooling for frequently spawned objects - Use texture atlases for sprites - Optimize collision shapes (use simpler shapes when possible) - Implement culling for off-screen entities - Profile and optimize expensive functions ## Compatibility Testing Test your game across all target platforms. ### Platform Matrix Create a testing matrix like this: | Feature | Windows | macOS | iOS | Android | HTML5 | |---------|---------|-------|-----|---------|-------| | Controls| ✓ | ✓ | ⚠️ | ✓ | ✓ | | Performance| ✓ | ✓ | ✓ | ⚠️ | ✓ | | Save/Load| ✓ | ✓ | ✓ | ✓ | ⚠️ | ### Input Testing Test all input methods for your platformer: - Keyboard - Gamepad - Touch controls - Custom input devices ### Resolution Testing Verify your game works well on different screen sizes and aspect ratios: ```mermaid graph TD A[Resolution Testing] --> B[Desktop: 16:9, 16:10, 4:3] A --> C[Mobile: Portrait & Landscape] A --> D[Unusual Ratios: Ultrawide, etc.] B --> E[UI Scaling] C --> E D --> E E --> F[Camera Behavior] F --> G[Platform Visibility] ``` ## Bug Tracking and Management Establish a system for tracking and prioritizing bugs. ### Bug Report Template Create a template with fields like: - **Title**: Brief description of the issue - **Steps to Reproduce**: Numbered steps to trigger the bug - **Expected Result**: What should happen - **Actual Result**: What actually happens - **Environment**: Platform, OS version, etc. - **Screenshots/Video**: Visual evidence - **Severity**: Critical, Major, Minor, Cosmetic ### Bug Priority Matrix Prioritize bugs using this framework: ```mermaid quadrantChart title Bug Priority Matrix x-axis Low Impact --> High Impact y-axis Low Frequency --> High Frequency quadrant-1 "Monitor" quadrant-2 "Fix Soon" quadrant-3 "Low Priority" quadrant-4 "Fix Immediately" "Minor visual glitches": [0.2, 0.3] "Occasional sound issues": [0.3, 0.4] "Rare crash on level exit": [0.7, 0.2] "Controls unresponsive after death": [0.9, 0.8] "Player falls through platforms": [0.8, 0.7] ``` ## Pre-Release Checklist Before releasing your platformer, complete this comprehensive checklist: ### Gameplay - [ ] All levels are completable - [ ] Difficulty progression is balanced - [ ] No soft-locks or unwinnable situations - [ ] All collectibles are obtainable - [ ] Game mechanics are clearly introduced ### Technical - [ ] No crashes or freezes identified in testing - [ ] Performance is stable on all target platforms - [ ] Loading times are reasonable - [ ] Save/load functionality works reliably - [ ] All known critical and major bugs are fixed ### User Experience - [ ] Controls are responsive and intuitive - [ ] UI is clear and functional at all supported resolutions - [ ] Audio levels are balanced - [ ] Text is readable on all devices - [ ] Tutorial/onboarding is effective ### Platform-Specific - [ ] Platform certification requirements are met - [ ] Store assets (icons, screenshots) are prepared - [ ] Age ratings are determined and submitted - [ ] Platform-specific features (achievements, etc.) are implemented --- By implementing a thorough testing strategy, you'll create a more polished and enjoyable platformer. Remember that quality assurance is an ongoing process throughout development, not just a final step before release.