views:

64

answers:

1

How would you Unit Test the update process of an application?

I have an application and now I'm writing my own Update module for it (using MVVM) which is a separate EXE. What is the best way to structure this module so that it will be possible to unit test.

+1  A: 

Very interesting question. I am also working on an update application at the moment - I'm using the Microsoft Updater Application Block to allow the application to download updates over http and update itself.

I have designed my application using an Interface-based programming approach to allow me to easily mock implementations to help in unit testing. There's also some very good mocking frameworks available. http://stackoverflow.com/questions/37359/what-c-mocking-framework-to-use

In terms of testing downloading an update, installing it, testing versioning etc. I think a Test Harness might be more appropriate than Unit Tests?

Peter Kelly
Could you elaborate on test harness?
LnDCobra
I should have said "Test Harness might be more useful for certain parts". My test harness is a basic win forms app that allows you to configure the updater app. I run it against localhost and download an update and the version numbers of the old and new files are displayed. You are right though - it is not trivial to test an updater app and I've been fighting long and hard to get every corner of it tested. I have not thought of a repeatable, independent way to unit test an updater app so I guess I really haven't answered your question at all.
Peter Kelly