Last Updated: February 25, 2016
·
1.182K
· alexanderbrevig

In game console/REPL for faster test cycles

(Although this is intended for games, many applications will also benefit from a console/REPL')

One of the things that has reduced my test cycles the most is the introduction of a console/command interface in the game that enable me to send commands to the game as it plays.

These commands are implemented in a way that configures the game to a certain known state. From that state, I can test whatever I need.
This is in great contrast to the usual manual way when we play the game until it meets the preconditioned state before testing what should be tested.

Additionally, I made the commands as generic as possible. Say for instance that I implement an EndGame command, this command would force the game to an end game state. When I have this command implemented, this is the command that I would execute wherever the game detects that an end game state is appropriate.

So, I speed up my test cycles AND provide a natural way to reuse code that causes side effects to the states of my game.

PS: Be sure to never build a production version with the console, unless it's password protected.

' http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop