Unit test harness that works in two steps:
- mark up unit test classes and methods with [TestClass] and [TestMethod] respectively,
- add the UnitTestRunner component to some kind of a global game object that exists at start time.
When started up in the editor, UnitTestRunner will
- scan all assemblies for classes annotated as TestClass
- create an instance of each such class, then
- run each method annotated as TestMethod
- finally, report any failures and run time
UnitTests only get run in the editor.
UnityTestUtils provides a simple Assert class for testing inside unit tests, eg.
var result = FunctionToBeTested();
Assert.IsNotNull(result);