Friday, May 18, 2007

TESTDRIVEN.NET AND XNA

There has been many questions in the XNA Creators Club's forums regarding unit tests with the express editions and particularly with XNA GSE. Well, not only unit testing can be executed with the latter but also, TestDriven.NET can be also used again since version 2.5 (still in beta stages). However, from time to time we may found some exceptions with tests related to the content pipeline. Henning Degn explains us why and also brings a simple workaround to that issue.

From Degn's article: "... Some tests in XNA cannot be done dynamically. These tests usually require visual inspection and therefore need to be run manually. Using Testdriven.net you can run test scenarios, simply using an ad hoc test of a function containing the test. Simple. Effective. No need to modify the main method to run these functions.

However, when using any XNA content I have stumbled on the following error:

Microsoft.Xna.Framework.Content.ContentLoadException
File not found. ---> System.IO.DirectoryNotFoundException:
Could not find a part of the path 'C:\WINDOWS\assembly\GAC_32\Microsoft.Xna.Framework\1.0.0.0__6d5c3888ef60e27d\Content\myTexture.xnb'

The reason being that (naturally) I didn’t put my content inside the GAC (Global Assembly Cache)! The ContentManager is using the codebase of the assembly who’s main method called it as its root ...".

BTW, in some chapter of Benny's book it's stated that this tool cannot be used with XNA GSE. Please notice that by the time the book was written, v2.5 beta -the build that reimplmented support for express editions- hadn't been released.

Cheers!

No comments:

Post a Comment

Any thoughts? Post them here ...