In certain realms of software development, automated unit testing and the spirit of Test Driven Development is imbued in every step of the development process.
However, with game dev I’ve found that I don’t know where to start when adding testing!
Do I do it all via mocked input commands?
Do I test each method in a class or prefab (for Unity)?
Do I just keep plugging away until something comes up when manually playing?
I enjoy the scrappiness of just developing until something breaks, however I find myself longing for the security of the ornately knit yet comforting quilt of unit testing.
Does anyone have any examples of how they structure or organize automated testing for their games?
Thanks letsbuild community!
Discussion
Depends on unit or feature tests. Unit tests test a specific piece of the application. A feature test tests a whole feature.
You will miss tests, when a bug occurs you then write a test to make sure it doesn't happen in future.
Take the login page of a game. Things you can test.
If your testing quests, you would want to test the right dialogue appears, the npc spawns correctly, that the monster can be killed and that you can hand in the quest.
Lots of things you can test :)
I feel you in trying to make sure you're designing your game to be testable if something is found. One technique I tried was making a separate project for all my game logic. So I wrote my tests around all that and imported it as an asset when I was ready.
While trying it out I found a situation where the http calls weren't compatible so I created interfaces where things weren't compatible. Other than that I trusted the Unity input system to provide the inputs and act as a pass-through to do any calculations.
I'm very curious how others have tackled this problem as well!