Coded UI and Silverlight… simple

In fact it took me an appallingly long time for the penny to drop, but all the clues are in the generated code when you use the Test Builder.

So here is a picture where [1] is the BrowserWindow… and [6] is one of the Silverlight controls:


This is the single (text) control I’m testing:


These are that control’s properties in Silverlight:


In the generated test (i.e. Record and Playback, [1] is the hand-added launch of the browser, [2] is the call to the test class that the generator put there:


The content of that method, which shows the cascaded calls:


The pattern used at each of the levels:


The classes and constructors where relevant for each of those elements (this is a generated file which will be rebuilt the next time you define er stuff, but it gives you a good template):

CodedUiHandNotes08 CodedUiHandNotes09 CodedUiHandNotes10 CodedUiHandNotes11 CodedUiHandNotes12 CodedUiHandNotes13

and a very trivial proof that it works… of course it does, as it’s basically the Record and Playback:

CodedUiHandNotes14 CodedUiHandNotes15


I have pasted a version of the Coded UI here…

, and a version of the SLUT here (XAML):

, and the code behind:

(remember the need to include this:

using Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s