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: ,

6 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?

Leave a Reply