Main Site Documentation

Unit testing


#1

I recently started a project to build an open source network enabled thermostat and home automation controller. I spent the last few nights building a basic framework for the thermostat functionality and have the basic thermostat routine mostly working.

I was wondering if anyone had any experience with unit test frameworks for the .net micro framework. I would really like to have some automated tests i can run the control algorithm through before i hook this up to my AC and let it wreak havoc on it. I was looking at NUnitLite and MFUnit but was wondering if anyone had any experience with these frameworks or others. Also any insight on mocking sensors so that the tests can be run without needing any hacks in the production code.


#2

SO after a bit of investigation I opted for the bucket of icecream method to test my thermostat logic. I basically placed or removed a bucket of icecream near the sensor to generate temperature fluctuations and test the logic of my thermostat control algorithm. Eventually I will open the source for the sensor drivers I’m using and implement an interface for them so that i can generate mock classes for use during automated testing. I looked into rhino mocks a little bit but since the drivers are concrete classes I wouldn’t be able to use rhino mocks to mock them out correctly without modifying the source anyway. MFunit looks like it will work properly though for building test projects in solutions if you can properly mock the sensor inputs.


#3

I’ve never used this unit test framework, but I believe there was some discussion of it on this forum several months ago: