views:

40

answers:

1

Hi

I have a largish application that uses MVVM. The Model is mostly in a C++ DLL. The ViewModel is in C#, and I've tied my WPF controls to the ViewModel in the usual way.

The app is ready for integration testing. I can drive tests from within the application, but I'd like to move testing out into another process so I can minimize polluting the application with test stuff.

I'd like to write the test application myself in C# and WPF, but I'm a bit stuck as how to go about it.

Note: If there's a third party testing application for testing ViewModels inside a .Net application, I'd love to hear about that too!

I imagine Process.Start is the initial way in, but from there I'm lost.

Basically I need to let the application load up normally, create its Model as usual, and start the GUI, so I can't drive individual methods in isolation (unit test style). Then I would like to set and get my ViewModel properties as I do currently with my local tests.

I've looked at James McCafferey's MSDN 03/09 article on testing WPF apps, but it's geared towards testing the GUI (basically remotely pressing Buttons etc), something I want to get away from.

Is reflection the way in here? If so, how, bearing in mind I can't simply reflect onto an 'empty' ViewModel, it has to be connected to my Model for the VM properties to be testable.

Thanks in advance

A: 

Basically I need to let the application load up normally, create its Model as usual, and start the GUI, so I can't drive individual methods in isolation (unit test style).

IcuTest (http://IcuTest.com/) is what you're looking for. It let's you start the app in a unit testing framework AND let's you interact with your Models and methods.

Ray
Looks like IcuTest works by comparing screenshots before and after an action - not really what I'm after, as I've gone to all the trouble of implementing MVVM to avoid this kind of 'brute force' testing. With my in-process test harness I can directly interrogate my ViewModel's values, regardless of whether they equate to a visible entity in a View. I just want a way to move my test harness code out of process.
Surfbutler