alkampfer on October 30th, 2009

I must admit that I’m absolutely not a fan of testing through UI. A good program keeps the business logic separated from the UI, so it is testable without passing for the UI. In the real world we have application written by others, or you can simply have to test UI control interaction. In these scenario interacting with the UI can be a viable option. Let’s see how VS2010 can helps us.

You have a new type of unit test, called Coded UI test, when you create test the test will ask you how you will write the test

image

Simply choose to record action, a recording toolbar will shows up

image

Now simply press record, then press “Start without Debugging” on my project. My program opens (a simple form to divide two integers), and I begin interact with the form. Here is the result.

image

As you can see the recorded intercept the launch of my application, and the interaction with the form. When you finished recording, you can simply press the “Generate Code button” and have a new test generated.

Now I suggest you to rename the test (VS calls it CodedUITestMethod1), and when you run it, you can look at the program open again and all of your actions replayed :) .

Alk.

Tags:

kick it on DotNetKicks.com

Tags: ,

11 Responses to “Coded Ui Test in VS 2010”

  1. Coded UI tests aren’t available in 2010 professional versions :(
    I’m right?

  2. I do not remember well, but It seems me that you need premium to have coded ui test.

    alk.

  3. Hi Alk – Stumbled on your blog by chance – nice blog! Will index it on my reader.

    Hi Diego – You need to get the Ultimate version to use CUIT. Check out http://blogs.msdn.com/anutthar.....tures.aspx for more details.

  4. The coded UI test is available with all the test components with the Visual Stuidio Ultimate edition or as stand alown license

    Best Regards,
    Eran Ruso

  5. Can anyone help me how test random label displaying in a page using coded ui test to get the labelfor value using coded ui

  6. Can you explain better your sceanario?

  7. hi,
    i am new to coded ui can u please give me some links regarding how to work with coded ui. also earlier i worked with qtp is that experience works with this tool? and how can i start with descriptive programming in coded ui?

    thanks in advance

  8. A good starting point is (http://msdn.microsoft.com/en-u.....86726.aspx) and I suggest also having a look at MTM (Microsoft Test Manager).

  9. Hi,
    I have a list of Doubts Please paste this link. you can find the attachment.This is comparision of CUI with QTP plz resolve this sheet

    its urgent
    thanks in advance

    https://spreadsheets1.google.com/ccc?key=tqkK8Db1bGSy-PxNgFOzVng

  10. Hi Alk, i am facing a problem in clicking on an object i am giving all the search properties to click on the object it is throwing an error message like “could not able to find the control Page is refreshing” i tried with wait ,and sleep methods to wait the Execution still showing same message.is there any other way to Synchronize the tool and application?? notice that in my application page containing grid colums will be updating for every three minutes. please try to give a solution

    Thanks in Advance.

  11. I think you should ask this question in the official forum ;) (http://social.msdn.microsoft.c.....st/threads) probably you can have quicker response :) .

    As soon as I have time I’ll try to figure out a solution, but to understand what is wrong probably you should create a working sample of your application to play with it. ;)