CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2009
    Posts
    6

    Creating Unit test methods for the methods that involves GUI opeations

    Hi All,

    Can anyone of you please clearly explain about VSTS(Visual Studio Team System). Iam very new to VSTS and asked to investigate about creating Unit tests for both non-GUI (logical) and GUI methods. We were successful to create and run Unit test methods for non-GUI related fuctionality. But, we are facing problems to run GUI unit tests. For eg: we have created a unit test method for adding a node in a treeview. The test method ensures that the created node is visible on treeview. But, when we run unit test method for the same we observed that the node gets created but is not shown up on treeview. Can anyone please explaing if we can create GUI unit tests and see the GUI operations while they execute?

    Thanks,
    Sravani

  2. #2
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Creating Unit test methods for the methods that involves GUI opeations

    I don't think VSTS or many of the other Unit Testing frameworks are designed for GUI tests. For that you need another type of tool. You need to look into Automated Testing tools from the Testing point of view and not a development point of view. Frameworks such as VSTS are geared towards development and can assist in doing Test Driven Development and with the right tools with a Continuous Integration based approach.

  3. #3
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Creating Unit test methods for the methods that involves GUI opeations

    For testing UIs you should have a look at the MVC (model view controller) or MVP (model view presenter) design methodologies.

    They allow you to test your UI by using interfaces and mock-ups in your unit testing code.

    I think they're about as good as you can get with UI testing. Apart from employing a few people to test the product manually.

    I personally don't use the visual studio unit testing framework. I prefer NUnit instead. I'd have a look at NUnit if I were you - at a recent talk by Microsoft I went to on F# they admitted they test it using NUnit !

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Creating Unit test methods for the methods that involves GUI opeations

    Quote Originally Posted by darwen View Post
    I think they're about as good as you can get with UI testing. Apart from employing a few people to test the product manually.

    I personally don't use the visual studio unit testing framework. I prefer NUnit instead. I'd have a look at NUnit if I were you - at a recent talk by Microsoft I went to on F# they admitted they test it using NUnit !

    Darwen.
    You can get a high degree of GUI testing reliability if you take the correct approach. Many folks try to cut corners with GUI testing and hope to build up a series of test cases using the 'recorder' approach. While this method is impressive to managers, it's not robust enough to use in the real world. UI test automation can be made reliable but it takes effort.

    The use of NUnit at Microsoft is group specific and doesn't mean that NUnit is superior. I've used both and prefer built-in unit test within VSTS because I can debug without attaching to a process (unlike NUnit). Plus, I find the test management interface of NUnit hokie - its looks reminds me of the TestRunner interface that I used to use in MSTest 3.0 (or Visual Test 4.0) back in 1995. That interface was clunky, had hotdog stand colors and NUnit seems to have copied it faithfully.
    Nunit is okay, but I prefer the built in testing fram

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured