• Advertisement
Sign in to follow this  

Do you use unit tests in game develpment?

This topic is 3226 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey! I'd like to know if you use unit testing in your game development process and if you believe if it is useful or a waste of time. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I'm an avid proponent of TDD.

There is an overhead required to write code under test. The benefits of having everything under test is reduced maintenance costs. Our big libraries that persist make sense to be under test, as they spend years under maintenance.

The final games ship on disc or cartridge, and are only maintained during beta; the beneficial time for having it under test is small, and does not justify the cost of putting it under test.

The cost for the company to employ an army of testers is less than the overhead cost of developing automated test code.


So do I use TDD:

At work - Tools team and libraries yes, the actual games no.

On personal projects including games - yes. I don't have a dedicated test team so I need to take advantage of everything I can.


Share this post


Link to post
Share on other sites
Short answer: Yes.
Long answer: Yes, but I don't really follow any of the standard methodologies or approaches while doing so. If I make a class or component, I'll plop it into a simple console application and run a handful of tests to make sure it works the way I intended, debugging any issues that crop up and (usually) doing a stack trace and inspection just to make sure there aren't any problems under the hood. As any sane programmer will tell you, the best way to debug is to isolate as much as possible.

Share this post


Link to post
Share on other sites
We have used unit test at our studio, usually this is to test certain classes or libraries with the code to ensure they function as intended, they are one aspect of testing.

Share this post


Link to post
Share on other sites
Yes, we use them at CCP games.

We have a custom framework with custom integration of unit tests. You can watch a presentation by me on this topic which hopefully describes this usage understandably.

Share this post


Link to post
Share on other sites
Quote:
Original post by rmtew
Yes, we use them at CCP games.

We have a custom framework with custom integration of unit tests. You can watch a presentation by me on this topic which hopefully describes this usage understandably.


Interesting video.
I had no idea EVE was created with Python. Impressive.

Does anyone know any interesting link to unit tests applied to game programming?

Thanks a lot.

Share this post


Link to post
Share on other sites
Yes, I'm using unit tests. I'm not doing full TDD (yet), but I'm slowly getting there.

Most of my shared game code already has 100% test coverage and it has really had a profound effect on code quality, not only from the perspective of bug reduction, but also in terms of design and designing classes that a conveniently usable without much setup work. Having to design your classes in such a way that you can easily test them really forces you to think about decoupling and speaking interfaces.

I'm also using Continuous Integration to make sure changes to my shared code don't break other projects than the one I'm currently working on and it's an immense time-saver. Without unit tests in place, that wouldn't be possible.

Share this post


Link to post
Share on other sites
I get very nervous when I write any code not using a TDD-like methodology.

I even write unit tests for prototypes.

Share this post


Link to post
Share on other sites
Quote:
Original post by riruilo
Quote:
Original post by rmtew
Yes, we use them at CCP games.

We have a custom framework with custom integration of unit tests. You can watch a presentation by me on this topic which hopefully describes this usage understandably.


Interesting video.
I had no idea EVE was created with Python. Impressive.

Does anyone know any interesting link to unit tests applied to game programming?

Thanks a lot.

It's actually stackless Python they use.
Benjamin Nitschke's XNA book makes extensive use of unit testing throughout his book. A bit too much methinks.

[Edited by - daviangel on April 21, 2009 1:29:50 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by riruilo
Hey!

I'd like to know if you use unit testing in your game development process and if you believe if it is useful or a waste of time.

Thanks in advance.


IMO, as soon as you're writing tech for more than one game (and don't have time to fully test each game) unit tests become invaluable, before that they are just valuable.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cygon
Yes, I'm using unit tests. I'm not doing full TDD (yet), but I'm slowly getting there.
Same here.
Having unit tests for every bit of functionality is become more and more useful for me as I'm writing more templated code at the moment (which doesn't get compiled fully unless it is used).

As with the TDD philosophy, my unit tests run at compile time so it's easy to see if you've broken something.

Share this post


Link to post
Share on other sites
Quote:
Original post by frob
I'm an avid proponent of TDD.


Can you give me some idea how you go about using TDD in games? I've found that I quickly come unstuck after the core classes are verified correctly - it's also very hard to keep the motivation to use TDD and not just go ahead and code anyway.

Share this post


Link to post
Share on other sites
Quote:
Original post by evolutional
Quote:
Original post by frob
I'm an avid proponent of TDD.


Can you give me some idea how you go about using TDD in games? I've found that I quickly come unstuck after the core classes are verified correctly - it's also very hard to keep the motivation to use TDD and not just go ahead and code anyway.


TDD isn't about verification so much as it is design. If you're looking at it from a "make sure my stuff works" perspective, that may be part of the problem you're having.

Also, it's easier if you have a way to abstract out "peer" classes or collaborators, so that you can actually test classes in isolation. Otherwise, the weight can become too much.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement