Hi, as I searched already quite a bit on the WWW without any major success, hopefully you guys can help me a little.
I’m working on some smaller controllers and currently without any OS. This leaves me with the task that some time consuming activities need to be split into smaller parts. So main is not blocked for a longer time. Usually I try to do this with state machines. Thus my modules (let’ say for reading/writing EEPROM) have some methods for triggering certain tasks (read, write, …), an execute method to process the state machine and an IsCompleted method to determine whether the triggered task is accomplished. Not sure whether this is from a design aspect a good idea, but it works okay. Now the obvious problem is writing some good tests for that. In order to test certain parts of the state machine I need to trigger the task and then need to call execute “several” times. Moreover it is then pretty difficult or event not possible to assert whether I’m in the expected state. This seems to have some obvious disadvantages for creating and especially maintaining the tests.
Any ideas how to better design/implement the modules so that testing gets easier and more maintainable?
Thanks a lot and enjoy embedded development in 2013!
PS: Hope the question isn’t too generic.