Michael Crump bio photo

Michael Crump

Works @Microsoft on Windows

Twitter Google+ LinkedIn Github Youtube Flickr

With the release of Visual Studio 2010 Feature Pack 2 Microsoft included the Coded UI Test framework. With this release it is possible to create automated test with just a few mouse clicks. This is a very powerful feature that all Silverlight developers need to learn. Instead of my normal blog post I have created a video tutorial that walks you through it starting from “File” –> New Project. I hope you enjoy and please leave feedback.

Video Tutorial (short 9 minute video):

Slides from the demo (only 3):

Silverlight 4 – Coded UI Testing

Code for the MainPage.xaml that was used in the Demo. For the sake of time I did not go into the AutomationProperties.Name that I used for the TextBox or Button. I added that for each element .

<Grid x:Name="LayoutRoot" Background="White" Height="100" Width="350">      <Grid.ColumnDefinitions>          <ColumnDefinition/>          <ColumnDefinition/>      </Grid.ColumnDefinitions>      <Grid.RowDefinitions>          <RowDefinition/>          <RowDefinition/>      </Grid.RowDefinitions>      <TextBlock Padding="15" Grid.Column="0" TextAlignment="Right">Name</TextBlock>      <TextBox AutomationProperties.Name="txtAP" Grid.Column="1" Height="25" TextAlignment="Right" Name="txtName" />      <Button AutomationProperties.Name="btnAP" Grid.Row="1" Grid.Column="1" Content="Click for Name"             x:Name="btnMessage" Click="btnMessage_Click" />  </Grid>