How do you test your game?

Hello

Lately, I realize testing my game to check if everything works fine was a lot harder than testing my little school homework and that it consumes a lot of my developing time.

What I used to do in my school homework was simply to print out the information transform by my program and then check if it’s the same as the value I expected. I repeat this test in a couple of different situations and if it’s correct all the time I consider it works. If no, I try to find the bugs.

The problem is that this method don’t work very well for testing my game. One of the issue I face is that my code is in a loop and it might work for the first 2000 times but at the 2001 time it will produce an unexpected behavior. No exception, no error, it’s just that it doesn’t produce the result I expected.
To test that, I usually try to execute the code on paper, if I think it’s correct I run it and stare at the program to see if it does the right thing (which can be pretty long).

I was wondering if anyone know a better method.

You may be able to do unit testing for some parts of your code, but mostly you just have to play the game and try to break it.

It’s usually a good idea to try to get other people to play it too.

I find writing tests annoying, and if I’m the only one going to be coding the game then I won’t write tests.
I just make sure my code is good quality (using findbugs plug-in helps) and have a good error logger which users can report the log to get it fixed.
Even though my game is an alpha it is very stable.

I have developed my own FPS and I give you the following advices:

  • write at least some unit tests for the most complex parts of your source code even though you’re alone on the project
  • use some tools that analyses your source code (Findbugs…)
  • release early
  • release often
  • if your project is open source, some people might give you more precise advices on the way of implementing some features
  • allow the users to test your game (ease the way of installing your game)

I play my games during development for about 4 hours every day - the other 4 spent developing or so. It’s pretty time consuming. When they’re nearly ready for release we let them loose into the wild and pick up any stranger exceptions automatically via our hiscore table. That quickly finds nearly all the crashing bugs and helps us focus on what to fix for the release. Rinse, repeat.

Cas :slight_smile:

Hmmm, looks like there is no way to avoid the play to find bug part :(. I usually test it after each modification so at least I find most of the bugs very soon.

I’m not familiar with unit testing. When you talk about the most complex parts of your code, does it means like the physics?

Physics or code that is dependant on other code that is dependant on other code and so on.

Also, know what to focus on with each bigger build and try to at least test the crucial functionalities every time to make sure that they still work.

As for my practise I stand in line with the rest of the answers, add some big feature and test it often. And have your friends play through things as often as you can.

Use the breakpoint tool in your program, it can be your best friend. Have a test somewhere for the specific type of bug you’re expecting, then once it’s broken you can see the values of all your variables. Similarly you can go through your code line by line to determine exactly what it’s doing.