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
Simply choose to record action, a recording toolbar will shows up
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.
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: Visual Studio
Tags: Testing, Visual Studio






November 1st, 2009 at 5:58 am
Coded UI tests aren’t available in 2010 professional versions
I’m right?
November 1st, 2009 at 12:36 pm
I do not remember well, but It seems me that you need premium to have coded ui test.
alk.
November 9th, 2009 at 4:46 am
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.
January 24th, 2010 at 3:57 pm
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
March 31st, 2010 at 11:03 am
Can anyone help me how test random label displaying in a page using coded ui test to get the labelfor value using coded ui
April 1st, 2010 at 10:13 am
Can you explain better your sceanario?