How can I be sure I tested my battleship project properly?


#1

Question

How can I be sure I tested my battleship project properly?

Answer

There are a couple test cases you should run through and if you’re met with any errors, you’ll know where to look in your code based on what you’re trying to test.

  1. Guess a row and/or column value that is 5 or greater, your code should print that it’s not in the ocean and loop again.
  2. Guess an incorrect coordinate that you haven’t guessed before, your code should tell you that you missed.
  3. Guess another incorrect one that you have guessed already, and your code should tell you that.
  4. Guess incorrectly on your 4th turn and you should see game over.
  5. Guess correctly at any time and you should see a congratulations and your code should exit!

FAQ: Learn Python - Battleship - To Your Battle Stations!