Wednesday, June 20, 2018

Test Driven IF?!

Recently I watched a great video on TDD. It walked the viewer through building and running tests using Java and JUnit. It was cool seeing TDD outlined for beginners. It got me thinking about testing IF games. My engine currently handles 'tests', which are essentially just macros, but they make testing so much easier. Running a test, the game developer can perform any number of commands such as taking objects and arming the player with them (If they are weapons), as well as jumping to other locations within the game. But they are simply automated commands to the game's parser.

Now I've built a pass / fail testing engine. This is designed to run unit tests. Each test is defined in Norman notation like the rest of the game. A test consists of an initial input (commands run against the parser) and asserts which contain conditions. If the conditions are met the assertion passes. These are all checks against the output generated by the initial input or inputs within the assert. For example you could test the existence of a torch by moving the player into the room that contains the torch. Then calling the look command. If the output does not contain torch then it does not exist.

I've tested scenarios like the torch as well as hidden passages. So for TDD, I wrote a hidden passage test. It failed I created the hidden passage and hooked up it events and commands. Reran the test and it passed. Then I tested it manually, in game play.

This should be useful for testing complicated puzzles efc within the game.

No comments:

Post a Comment

From Shotcut to Kdenlive

So I've been using Shotcut for a while now, for my YouTube videos... and music videos. I love the application. Slicing clips, doing fade...