4

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.

Michal Ciechan
  • 13,492
  • 11
  • 76
  • 118

1 Answers1

1

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. https://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?

Community
  • 1
  • 1
Peter Kelly
  • 14,253
  • 6
  • 54
  • 63
  • Could you elaborate on test harness? – Michal Ciechan Apr 27 '10 at 18:14
  • 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 Apr 29 '10 at 16:20