.net - How to test a WPF user interface? -
using win forms mvc/mvp architecture, use class wrap view test ui while using mocks model , controller/presenter. wrapper class make in ui observable property test runner through properties , events.
would viable approach testing wpf app? there better way? there gotchas watch out for?
as testing itself, you're best off using ui automation framework. or if want more fluent , wpf/winforms/win32/swt-independent way of using framework, download white codeplex (provided you're in position use open source code in environment).
for gotchas; if you're trying unit test views, run in threading issues. instance, if you're running nunit default testrunner run in mta (multi-threaded appartment), while wpf needs run sta (single-threaded appartment). mike two has real easy getting-started on unit testing wpf, without considering threading issue. josh smith has thoughts on threading issue in this post, , points this article chris hedgate. chris uses modified version of peter provost's crossthreadtestrunner wrap mta/sta issues in bit more friendly way.
Comments
Post a Comment