locked
Visual Studio WPF Unit Testing... RRS feed

  • Question

  • HI All,

    I am new in Unit Testing. I am using vistual Studio 2008 and WPF.
    I want to do unit testing with WPF aaplication. Can anyone let me know where to start learning for this?
    Can you give me some links?

    Amit Jain http://www.cerebrata.com/
    Tuesday, July 14, 2009 11:40 AM

Answers

  • Amit,

    Here is a link to another article that you might find useful - "WPF Application Quality Guide".  This guide provides a lot of information about building WPF applications - including testing.

    Hope this helps.
    --- Thanks, Jeff (http://devmatter.blogspot.com/)
    • Marked as answer by Er. Amit Tuesday, July 14, 2009 1:26 PM
    Tuesday, July 14, 2009 12:54 PM

All replies

  • Amit,

    The trick to successfully unit test WPF applications, as well as any GUI-based application, is to ensure your application is based on a sound pattern for UI development that separates business & navigational logic from the UI components.  Some examples of these patterns include:

    • Model-View-Presenter (MVP)
    • Model-View-Controller (MVC)
    • Presenter First

    The first two patterns listed above have been around for quite some time.  The latter, Presenter First, has only been around a few years (as best I can tell).  These patterns have proven very useful for "typical" GUI-based development.

    With WPF, developers have started making use of another pattern - Model-View-ViewModel (MVVM).  This pattern is very well suited for WPF development which also provides a design mechanism for unit testing.  I would recommend reading the following article from MSDN - "WPF Apps With The Model-View-ViewModel Design Pattern".  This article covers the MVVM pattern as well as gives examples of how to implement it - including unit tests.

    As a side note, the MVVM pattern works very well with Silverlight development as well.

    Hope this helps.


    --- Thanks, Jeff (http://devmatter.blogspot.com/)
    Tuesday, July 14, 2009 12:15 PM
  • When you to test the UI of your application, you will currently need third party tooling (like http://www.testautomationfx.com/).

    The upcoming release of VSTS 2010 has a great new feature called "Manual Test Runner" that will support testing UI's, including WPF. Currently the Beta1 version is out, which is public available.
    Ewald - Please remember to mark the replies as answers if they help.
    Tuesday, July 14, 2009 12:18 PM
  • Hi Jeff,
    Thanks for your reply,

    We are using MVC Pattern. Can you tell me from where to start reading to do unit testing with WPF.
    Just now I am reading http://www.codeproject.com/KB/WPF/MVCtoUnitTestinWPF.aspx#s9 .
    If u have some other resources then please let me know. I want to test GUI made in WPF.
    I am just creating unit tests by right click on the function. Am I going in right direction?
    Amit Jain http://www.cerebrata.com/
    Tuesday, July 14, 2009 12:26 PM
  • Amit,

    Here is a link to another article that you might find useful - "WPF Application Quality Guide".  This guide provides a lot of information about building WPF applications - including testing.

    Hope this helps.
    --- Thanks, Jeff (http://devmatter.blogspot.com/)
    • Marked as answer by Er. Amit Tuesday, July 14, 2009 1:26 PM
    Tuesday, July 14, 2009 12:54 PM
  • Thanks a lot Jeff.
    Amit Jain http://www.cerebrata.com/
    Tuesday, July 14, 2009 1:25 PM
  • Hi Amit.

    Try http://www.IcuTest.com .

    Friday, February 19, 2010 1:08 AM