Testing & Verification

Table of Contents



Gameplay Testing

Conducted frame by frame gameplay testing to verify that all the interactions and movement behave as intended

if (player && wolf && this.checkPlayerWolfCollision(player, wolf)) {
  // Resets player coordinates back to start upon failure condition
  player.position.x = this.redStartPosition.x;
  player.position.y = this.redStartPosition.y;
  player.velocity.x = 0;
  player.velocity.y = 0;
}



Integration Testing

Performed integration testing to ensure that game code connects and communicates with the backend database.

this.leaderboard.submitScore(name, parseFloat(timeTaken), "RedRidingHood")
    .then(() => {
        // Confirms successful connection and communication with backend
        this.successElement.querySelector('#inputArea').style.display = 'none';
        finalBtn.style.background = "#28a745"; 
        finalBtn.innerHTML = "GO TO LEVEL 2 →";
    })



API Error Handling

Implemented API error handling using structured JavaScript blocks. The code prevents internet disconnects from freezing the game loop.

async fetchPreviewUrl() {
  try {
      const response = await fetch(this.endpoint);
      const data = await response.json();
      return data;
  } catch (error) {
      // Catch block intercepts network failures to prevent game crashes
      console.error("API Gateway Connection Error:", error);
      return null;
  }
}