views:

1147

answers:

6
+5  Q: 

XNA Unit Testing

So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic :-)

+1  A: 

I would that this question is geared more toward the approach of unit testing in game development. I mean, XNA is a framework. Plug in NUnit, and begin writing test cases while you develop.

Here is a post on SO about unit testing a game. It'll give you a little insight into how you need to think while progressing.

David McGraw
A: 

VS2008 has a nicely integrated unit testing framework. (I assume you're using using the XNA 3.0 CTP with your Zune.)

Cat
+1  A: 

XNA BOOK

This book shows how to code in XNA but the entire book is based on NUNIT testing. So while you are coding the projects in the book, he also shows you how to write the scripts for NUNIT to test the XNA code.

autonm
A: 

The Microsoft testing framework is now available in Visual Studio 2008 Professional and up. If you have this software you already have all the software that you need to start testing your games.

Here are two links that will get you started: Unit tests Overview - http://msdn.microsoft.com/en-us/library/ms182516.aspx Creating Unit Tests - http://msdn.microsoft.com/en-us/library/ms182523.aspx

If you only have the Visual Studio 2008 Express than you need to use some other testing framework. NUnit is probably the best one, some people even prefer it to MSTest.

After you have all the software you need you can start adding tests for your code. Here I've posted some basic techniques about unit testing games that you might find useful.

Have you done unit testing before? If you haven't I could posbily give you some more hints and resources

Milan Nankov
A: 

You should give Scurvy Test a try. Have not used it my self but it looks promising.

Tiggerizzy
A: 

I know this is an old post, but for other people wondering how to best go about testing their XNA Games, there is another option. The built-in testing in Visual Studio is definitely great, but is not well suited for games. Everytime a value is needed, you have to pause the game, and then either hover over the variable, go to quick watch, or add a watch. Then you can see the value of the variable at that frame. To see the value again during another frame, you must pause your game, again. This can be a big hassle. Therefore I have created a debugging terminal to run on top of your game. It allows you to see values of variables, invoke methods, and even watch a variable change in real-time all while you game is running! To find out more, visit: http://www.protohacks.net/xna%5Fdebug%5Fterminal/

The project is completely free and open source. If you like it, feel free to tell others using XNA Game Studio about it. Hopes this helps out!

BluePlateSpecial