Skip to content
qwertie edited this page Aug 10, 2014 · 1 revision

I wanted to make a lightweight unit test framework and a convenient unit-test runner that runs tests automatically whenever an .exe/.dll file changes. If it is ever completed, it will run both NUnit and Loyc.MiniTest tests.

The idea of this test runner is that you shouldn't have to have to reference a specific unit test framework DLL in order to define unit tests. MiniTestRunner simply looks for attributes that are called [Test] and [TestFixture], but does not require the attributes to be in any particular namespace or DLL. Thus, you can define unit tests without taking a dependency on any particular "unit testing DLL"; you can define your own attributes, or you can use the simple unit testing attributes and Assert class in Loyc.Essentials.dll (Loyc.MiniTest namespace), which is a minimal subset of NUnit.

In fact, you don't need to define any attributes at all. MiniTestRunner will look for any class that starts with "TestFixture_" or ends with "_TestFixture" and treat it as a test fixture, and any method that starts with "Test_" or ends with "_Test" is treated similarly.

A test method can return an IEnumerable<object> or object[] that enumerates child test fixtures. This makes it easy to re-run the same tests several times under different configurations or environments.

Finally, I planned to add benchmarking features to MiniTestRunner, and time measurements would be recorded for every test.

I did not finish it, though. It can run tests but I had trouble figuring out how to design the system so that it could unload .exe/.dll files, leaving behind a representation of the test tree, and then reload the same .exe/.dll files and update the test tree to reflect any changes.

Basically, I have a mental block that's preventing me from finishing the program. Also, I really wanted to be able to run the test assemblies in "partial trust" mode. Theoretically AppDomains are supposed to support securely running untrusted code, but in practice it's undocumented and very hard to accomplish, and I had to give up.

It is a WinForms app structured with a model-view-viewmodel (MVVM) architecture based on the Update Controls library.

Clone this wiki locally