XNA Unit Testing

2020-03-01 09:39发布

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 :-)

6条回答
混吃等死
2楼-- · 2020-03-01 10:14

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

查看更多
等我变得足够好
3楼-- · 2020-03-01 10:16

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

查看更多
▲ chillily
4楼-- · 2020-03-01 10:18

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.

查看更多
啃猪蹄的小仙女
5楼-- · 2020-03-01 10:21

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

查看更多
兄弟一词,经得起流年.
6楼-- · 2020-03-01 10:26

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_debug_terminal/

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!

查看更多
Root(大扎)
7楼-- · 2020-03-01 10:28

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.

查看更多
登录 后发表回答