Game Development Community

dev|Pro Game Development Curriculum

Plan for MrPhil (Philip Ludington)

by MrPhil (Philip Ludington) · 12/02/2005 (1:40 pm) · 5 comments

So I have done two very rough prototypes of TSUnit. TSUnit is a unit testing tool for Torque Script (TS). One is a stand-alone tool that uses the debugger's telnet ability to run tests. The second is written in TS and simply generates errors in the console when a test fails.

Some of the stumbling blocks I have run into so far:
1. TS does not (AFAIK) have meta-data so I could not use a reflection system to discover tests
2. Having to run the "whole game" to do the tests is cumbersome and slow
3. I haven't figure out how to use the compiler/interpreter independently of the engine
4. I haven't figure out how to carry the tests around without cluttering up the game project

I'm committed to making a unit testing tool because Test Driven Development (TDD) is a central part of my code writing process. The question is, "Am I making the tool just for my personal use or is it something the community would value?" Ultimately I want to create a tool that makes the TDD cycle go as fast as possible. I could whip something together for my own projects pretty fast in C#, but the community would probably want something that has cross-platform support.

Finally, If anyone can direct me to any info, link, resource etc that might be relevant to this project I'd really appreciate it.

Game on,
MrPhil, Owner
Mr. Phil Games
PC-Strategy-Games.com

PS As I never got a good solution published you should check out Blue Raja's TUnit solution.

Previous Plan

About the author

My name is Philip Ludington, I'm a professional programmer by day and I dabble in game development by night. Learn more about my projects at www.MrPhilGames.com


#1
12/02/2005 (3:05 pm)
1. It's all available on the C++ side. You can traverse the function lists, member variables, etc. etc. etc. in fairly straightforward ways. Expose it to script if you want! Or write C++ helper functions to enable your unit test needs.

2. Run a minigame that does the testing. We do this for our demo packaging process - a 20 line script that processes PNGs into JPEGs with alpha is run instead of the normal main.cs. This approach would be sufficient for testing C++ level functionality as well as general purpose tests. Obviously for game-specific tests you'll have to load the game or parts of it. :)

3. Call compile() or eval(). :)

4. Make them a seperate game/mod. That way they can be easily stripped when you want to do a final build.
#2
01/23/2008 (1:51 pm)
Did anything ever come of TSUnit? I am trying to figure out how to use TDD with Torque Game Builder right now. Any suggestions?

Thanks,
Dave
#3
01/23/2008 (1:52 pm)
No sorry. I decided it wasn't worth the effort.
#4
01/23/2008 (1:56 pm)
Are you still using TDD? Did you decide it wasn't worth the effort for TS or in general?
#5
01/23/2008 (2:02 pm)
I still think TDD (Test Driven Development for those wondering) is great and use it when I can. I found over the years that trying to write tests against other peoples' engines and/or script is an exercise in futility.
Basically, I believe, it comes down to this: TDD doesn't work well with technology that was developed without unit testing. If you are committed to TDD I think you'd be better off getting something like PTK (www.phelios.com/ptk/) and building you architecture from the ground up.