Skip to content

Jeff Wilcox
Syndicate content
Silverlight, rich client apps and web development
Updated: 3 hours 58 min ago

Frame rate counters in Windows Phone

Mon, 07/26/2010 - 18:29

While developing Windows Phone applications, it’s good to have some simple but important performance tips and tricks in your back pocket. Here’s a quick reference to enabling frame rate counters plus an overview of what the values represent.

Enable frame rate counters in code

In your App.xaml.cs or MainPage.xaml.cs, in the constructor, set the host property to true for this diagnostic mode:

Application.Current.Host.Settings.EnableFrameRateCounter = true;
Make sure the System Tray is not visible

By default in the beta tools, the MainPage.xaml sets the system tray to be visible. When this happens, the frame rate counters are hidden by the operating system shell.

Method 1: XAML

The default page template includes an XMLNS declaration for “shell”, and has this in the phone application page constructor:

shell:SystemTray.IsVisible="true"

Just change the IsVisible property to False:

shell:SystemTray.IsVisible="false"
Method 2: Code
Microsoft.Phone.Shell.SystemTray.IsVisible = false;

In a future release of the phone tools, this is actually going to be less of an issue, as the counters will actually be right-aligned on the screen instead.

Adding a simple check box to toggle the counters

A lot of app developers add a check box to debug builds that lets them toggle this sort of diagnostic display. In one of our ‘Scenarios’ test applications, we have a check box on the first page, and in XAML it connects the Checked and Unchecked events to this method.:

private void FrameRateCounters_Checked(object sender, RoutedEventArgs e)
{
    var checkbox = (CheckBox)sender;
    var newValue = checkbox.IsChecked.GetValueOrDefault();

    Application.Current.Host.Settings.EnableFrameRateCounter = newValue;
    SystemTray.IsVisible = !newValue; // Hides frame rate counter otherwise
}
Enabling frame rate counters only on debug builds

You can also use conditional compilation to just have your debug builds display this information. Add this to your App.xaml.cs:

#if DEBUG
    Application.Current.Host.Settings.EnableFrameRateCounter = true;
    Microsoft.Phone.Shell.SystemTray.IsVisible = false;
#endif

This assumes you remember to eventually ship your app on the marketplace with a release build Smile.

Accelerated graphics note: If you still don’t see a frame rate counter

The frame rate counter only appears when your system has a supported DirectX 10 graphics card that allows the Windows Phone emulator to use accelerated graphics.

If you set the frame rate counter visibility to True, the system tray is hidden, and you still don’t’ see the counters, then unfortunately your system does not have a supported card for displaying this information.

All Windows Phone devices will show the frame rate counter, so once phone hardware is more widely available, you’ll still have an option to test the performance of your apps.

Exploring the frame rate counter data

This has been covered countless times, but I figure if you’re [using your search engine of choice to find this] here that it doesn’t hurt to duplicate.

BetaCounters

The Beta tools display frame counter information on the top of the page.

NewerCounters

Shipping frame counter information is displayed on the right of the screen.

So moving through the counters, we have the following.

Render Thread FPS: The number of frames per second that the independent simple animations and rendering thread is using. Keeping around 60 will provide a great experience, while a number of 30 fps will begin to show a poor experience to the end user.

Under 30 fps this counter will turn red in post-beta builds.

User Interface Thread FPS: The number of fps that the primary user interface thread is experiencing. Property change notifications, data binding, primary managed code execution, and animations not handled on the render thread use this threads’ resources.

Turns red when the count is at or below 15 fps.

Texture Memory Usage: A specialized memory counter indicating the video memory used for storing application textures.

Surface Counter: A count of the number of surfaces that are passed to the graphics chip.

Intermediate Texture Count: The number of intermediate textures created for compositing.

Screen Fill Rate: A metric representing the number of complete phone screens being painted each and every frame.

This counter was not present in the Beta tools and is a new metric for post-Beta use.

Target frame rates for good performance

When testing on a Windows Phone device, here are key performance metrics to try for. Understand that the emulator (XDE) performance may not be indicative of actual device performance.

Frame rate counters may be 0 when there is no animation being updated on the thread at any particular moment. You can add a very simple, continually animating and repeating, animation to your application during development & testing if you want to ensure that there is always some frame rate value available.

Counter Ideal Minimum Best Experience Theoretical Max Render Thread 30 fps 60 fps 120 fps UI Thread 15 fps > 15 fps 120 fps Screen Fill Rate 1.0 <= 2.0 N/A

Future posts will cover tips for improving the frame rate and application performance. Hope this helps.

Categories: Blogs

Updated Silverlight Unit Test Framework bits for Windows Phone and Silverlight 3

Thu, 05/27/2010 - 23:02

Here are updated quasi-official unit test framework bits for Silverlight 3 and Windows Phone developers. These are not intended for Silverlight 4 developers, since the same framework built for SL4 is included in the April 2010 Silverlight Toolkit.

This brings the new features from the Silverlight 4 version to developers who have a business reason to continue with Silverlight 3 development for the time being:

  • Updated user interface
  • Integrated “tag expression” support for selecting subsets of tests to run
  • Performance improvements
  • Removal of dependencies on XLinq and System.Windows.Browser assemblies

These are also the bits you want for Windows Phone testing.

Why wasn’t there one for Silverlight 3 already?

Since the April 2010 toolkit release was targeted for Silverlight 4 developers only, these bits were not released for version 3 (though were built from the same source).

Why doesn’t the April 2010 toolkit work for Windows Phone development & testing?

The Windows Phone development environment is based on a version of Silverlight 3 today, and so that means that you need to use Silverlight 3 binaries and class libraries when re-using Silverlight apps and code – not Silverlight 4.

These bits work well for phone developers and replace the older bits I had posted to my MIX talk site.

Download the binaries

[Silverlight 3 binaries for the Silverlight Unit Test Framework, Zip 452KB]
You may need to ‘unlock’ the binaries for security reasons once downloading and extracting the assemblies from the .Zip. To do this, right-click on the file and select the ‘Unlock’ button.

These binaries are strong named as before, but are not Authenticode signed, so they are not official. This helps work around some Windows Phone signing issues I’ve heard reports of.

Hope this helps,
Jeff

Categories: Blogs

How about a Zune-style ChildWindow?

Fri, 05/21/2010 - 23:25

Today I’m sharing my new ChildWindow style. It is a differentiated child window designed in that it doesn’t have a close button, has a completely different animation in and out, and I thought I was worth sharing. I’ve included a runtime app so you can run it and see for yourself.

My ChildWindow style

mycw
Click on the window above to open a simple Silverlight 4 application that demonstrates the transitions and interactivity. Project download.

Some things to call out:

  • I don’t include a Close button in the window chrome.
  • I hook up to the OnKeyDown event in my sample implementation. I always try and do this with my ChildWindows so that the escape (ESC) key can be treated as a cancelation of the dialog. Personal preference but a usability win I believe.
  • I like a light overlay color instead of a darkening experience, and went for that look.
  • My actual implementation uses a value converter to capitalize the title. I’ve removed this from my template for the time being.
The story on my evolving, unnamed theme, and how it relates to “Cosmopolitan”

There’s an excellent “Cosmopolitan” Silverlight project template + theme available that makes building good-looking interfaces a snap, and I’d highly recommend it if you’re looking to modernize the look of a new Silverlight project. I believe it pulls from “codename Metro” design ideas. It just works and as a VS template it rocks!

I’ve built an alternative, but similar theme, over time that I use on many of my projects, and it also pulls from the inspiration of the clean, consistent Zune software design principals.

Now that the “Cosmopolitan” theme is out there, I’ve been taking the time to compare and contrast my similar theme with this, and see where I can make changes. Yeah, the things I do in my free time are baffling…

This is a good exercise because design is a two-way street, comparing and contrasting design decisions and implementations: I’ve learned that I should have been including validation templates in my theme (oops, haven’t used that feature enough). And I’ve shared some minor feedback on parts of the “Cosmopolitan” theme’s implementation details with its designers.

In the future I’ll present the complete theme for many controls, but until that develops, I’m going to continue to share small styles and templates, along with my comments along the way. Previously I blogged my context menu style.

If you’re wondering “why should I use ChildWindow?” – I used to wonder the same thing. But I’m using ChildWindow more now than ever. I’ve discovered the importance of the nice integration with Visual Studio (there’s an item template for child windows), and out-of-browser applications have many uses for a rich modal-style window for sharing information at runtime.

I’ve completely replaced the MessageBox in my out-of-browser applications to instead use a child window designed to replace the message box functionality, offering a consistent visual design even when a message box-like experience is needed. I even use extension methods to add methods to MessageBox to instead use my styled child window.

Other ChildWindow styles

Here’s the standard ChildWindow style and control template that is built into the Silverlight SDK. I’m displaying a password entry form adapted from an app I was experimenting with:

cw1

Here is the same window with the “Cosmopolitan” theme’s style applied:

cwcosmo

Note: There’s a bug in ChildWindow implicit styling support

While working on creating themes, I did discover that there’s an unfortunate bug in Silverlight 4 where the implicit styles for ChildWindow are not picked up in certain XAML scenarios. Namely, if you use the handy item template in Visual Studio, the implicit style won’t be picked up.

Oddly, at times Visual Studio will show the proper implicit style, but at runtime it will revert to the standard control default style. Here’s a small screenshot – this is out-of-the-box “Cosmopolitan” theme with a ChildWindow item template.

At design time it looks fine:

dt

At runtime:

runtime_style_not_applied_bug

It appears that this item template format, where the XAML file of the child window’s root is the child window, doesn’t allow the style that was implicitly defined to be picked up.

No worries. To workaround this, add a Style attribute to the root of the file and a static resource to ChildWindow name. If you’re working with “Cosmopolitan”, then here are the steps:

  • Open the Assets/SDKStyles.xaml file
  • Navigate to the implicit style for ChildWindow around line 2,440
  • Add an x:Key to make the style explicit instead of implicit. x:Key=”ChildWindowStyle”
  • Add this line after the (now explicit) style:
<Style TargetType="controls:ChildWindow" BasedOn="{StaticResource ChildWindowStyle}" />
  • Open your ChildWindow XAML file (mine is called Password.xaml) and add the attribute Style=”{StaticResource ChildWindowStyle}” to the root element
And here’s it at runtime now with our fix/workaround:

cwcosmo

Note that whenever defining implicit styles myself, I always start explicit, then provide the implicit in the file using BasedOn.

Download my sample project including the style

[ChildWindowTheme.zip, 71 KB] Includes the theme in App.xaml.

“My yet-to-be-named Zune-inspired theme” components
Categories: Blogs

Windows Phone? Sounds exciting!

Fri, 05/21/2010 - 21:35

As an FYI, I wanted to let people know that I’m now focusing much more exclusively on the Windows Phone project here at Microsoft. Though the organization boundaries aren’t that exciting, I am still part of the great Silverlight team – only now more focused on the phone development story.

It’s a familiar crowd: many of the brightest from across the company have been joining the ranks, and a lot of the classic Silverlight Toolkit team members are a part of the effort.

The focus of this blog won’t be changing much at all – I continue to be involved in Silverlight Toolkit, the Silverlight Unit Test Framework, and anything else I can get my hands on.

Categories: Blogs

Using Silverlight 4 features to create a Zune-like context menu

Sat, 05/15/2010 - 21:25

Trying to create a modern, clean and crisp user interface is a challenge – and it’s something that Zune has done rather well in both their software and hardware experiences.

I took a few minutes to experiment with new Silverlight 4 features, including the new Silverlight Toolkit (April 2010 release) that includes a context menu control, to re-style/re-template the menu to look similar to a few other menus.

Here’s a quick look at some common context menu visuals – clearly there is some room for artistry in creating a consistent experience with your app.

ContextMenus

The center context menu, with the Windows look, is what the default Silverlight Toolkit context menu looks most similar to.

New features used
  • Right-click input event, added to the platform in Silverlight 4
  • Context menu control from the Silverlight Toolkit
  • Implicit styles support
  • Local fonts
Consider checking out ‘Cosmopolitan’, too

There’s a theme that resembles the modern “codename Metro” design style, similar to that of the Zune user interface, that is available for Silverlight 4. More information is available on Tim’s blog.

What a context menu looks like in XAML

You need an xmlns for the input assembly in the Silverlight Toolkit. Then you setup the ContextMenuService, a ContextMenu instance, plus multiple MenuItem and Separator instances.

A MenuItem can optionally have an icon, though I believe the trend these days is moving away from the icon-heavy menu and toolbar world into a clean & crisp text-only experience… so I prefer a styled context menu that doesn’t optimize for icons.

The XMLNS for the context menu assembly is:

xmlns:controlsInputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"

You can directly wire up to the Click event, or use Commands. Here’s a sample context menu within a data template:

<ListBox.ItemTemplate>
    <DataTemplate>
        <ContentPresenter Content="{Binding}">
            <controlsInputToolkit:ContextMenuService.ContextMenu>
                <controlsInputToolkit:ContextMenu>
                    <controlsInputToolkit:MenuItem Header="Play" Click="OnMenuItemClick"/>

                    <controlsInputToolkit:Separator/>

                    <controlsInputToolkit:MenuItem Header="Download" Click="OnMenuItemClick"/>
                    <controlsInputToolkit:MenuItem Header="Buy" Click="OnMenuItemClick"/>
                    <controlsInputToolkit:MenuItem Header="Add to cart" Click="OnMenuItemClick"/>

                    <controlsInputToolkit:Separator/>

                    <controlsInputToolkit:MenuItem Header="Add to playlist" Click="OnMenuItemClick"/>
                    <controlsInputToolkit:MenuItem Header="Add to burn list" Click="OnMenuItemClick"/>
                    <controlsInputToolkit:MenuItem Header="Add to now playing" Click="OnMenuItemClick"/>
                    <controlsInputToolkit:MenuItem Header="Mark as favorite" Click="OnMenuItemClick"/>

                    <controlsInputToolkit:Separator/>

                    <controlsInputToolkit:MenuItem Header="Send" Click="OnMenuItemClick"/>

                </controlsInputToolkit:ContextMenu>
            </controlsInputToolkit:ContextMenuService.ContextMenu>
        </ContentPresenter>
    </DataTemplate>
</ListBox.ItemTemplate>

And here’s what it looks like:

DefaultContextMenu

To use the ContextMenu, make sure your project includes references to both the toolkit’s System.Windows.Controls.Input.Toolkit.dll as well as the SDK’s System.Windows.Controls.dll.

Now I’d like to make this look more Zune-like.

Using implicit styles

So there are multiple ways to have a style (predefined look, settings and template) on your object:

  1. Default style key – the default template and style that the creator of the control had in mind. No work required.
  2. Implicit styles defined in Resources – in Silverlight 4, a Style defined by a user, but without an x:Key property, will automatically apply to all scoped controls of that type.
  3. Static resource styles defined in Resources – the standard experience up until now, having a Style with an x:Key, then setting the Style=”{StaticResource MyKeyName}” on any and all controls that want to use that style.
  4. Setting properties directly on an object.

So here is a standard, simple style for a Button, with the key:

<UserControl.Resources>
    <Style TargetType="Button" x:Key="MyButtonStyle">
        <Setter Property="Background" Value="Blue"/>
    </Style>
</UserControl.Resources>

Here’s how you reference it:

<Button Style="{StaticResource MyButtonStyle}" Content="OK"/>

And now let’s make that into an implicit style for Silverlight 4. Just remove the x:Key:

<UserControl.Resources>
    <Style TargetType="Button">
        <Setter Property="Background" Value="Blue"/>
    </Style>
</UserControl.Resources>

And here’s how you reference that style – you don’t – it’s implicit:

<Button Content="OK"/>

Small caveat, fyi: there is a bug with implicit styles not necessarily being applied within data templates. To work around this, I had to move to explicit styles (adding an x:Key to the style, then setting the Style property in the DataTemplate’s XAML to the static resource’s key).

Local fonts

I also used a feature of Silverlight 4 that lets me pick up and use local fonts on the machine. I’m using the ‘Segoe UI’ font, a key part of the Windows 7 user experience and visual identity.

However I also define fallback fonts, just like you would in HTML:

<Setter Property="FontFamily" Value="Segoe UI, Tahoma, Arial"/>
My Zune-like context menu

Here are the templates I ended up creating using Expression Blend.

To achieve the fade-in effect, I faked a little and used a Loaded event trigger, so the first time any particular context menu is shown, it will quickly fade – but subsequent presentations of the same instance will not fade, for a faster, more performant feel.

ContextMenu Style
<Style TargetType="controlsInputToolkit:ContextMenu" x:Key="ZuneLikeContextMenu">
    <Setter Property="Background" Value="#FFFFFFFF"/>
    <Setter Property="BorderThickness" Value="0,1,0,1"/>
    <Setter Property="BorderBrush" Value="#0D000000"/>
    <Setter Property="Padding" Value="0,4,0,4"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="controlsInputToolkit:ContextMenu">
                <Border
                    x:Name="Menu"
                    Opacity="0"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    CornerRadius="0">
                    <Border.Effect>
                        <DropShadowEffect
                            ShadowDepth="0" Opacity="0.6" BlurRadius="22"/>
                    </Border.Effect>
                    <Border.Triggers>
                        <EventTrigger RoutedEvent="Rectangle.Loaded">
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation
                                        Duration="0:0:0.2"
                                        To="1"
                                        Storyboard.TargetProperty="Opacity"
                                        Storyboard.TargetName="Menu"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Border.Triggers>
                    <Grid>
                        <ItemsPresenter Margin="{TemplateBinding Padding}"/>
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Separator Style
<Style TargetType="controlsInputToolkit:Separator" x:Key="ZuneLikeSeparator">
    <Setter Property="Background" Value="LightGray"/>
    <Setter Property="IsTabStop" Value="False"/>
    <Setter Property="Margin" Value="6,2,6,2"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="controlsInputToolkit:Separator">
                <Border
                    BorderThickness="{TemplateBinding BorderThickness}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    Background="{TemplateBinding Background}"
                    Height="1"/>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
MenuItem Style
<Style TargetType="controlsInputToolkit:MenuItem" x:Key="ZuneLikeMenuItem">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="FontSize" Value="14"/>
    <Setter Property="FontFamily" Value="Segoe UI, Tahoma, Arial"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Padding" Value="8,2,10,2"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="controlsInputToolkit:MenuItem">
                <Grid>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal"/>
                            <VisualState x:Name="Disabled">
                                <Storyboard>
                                    <DoubleAnimation Duration="0" Storyboard.TargetName="Presenter" Storyboard.TargetProperty="Opacity" To="0.5"/>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="FocusStates">
                            <VisualState x:Name="Unfocused"/>
                            <VisualState x:Name="Focused">
                                <Storyboard>
                                    <DoubleAnimation Duration="0" Storyboard.TargetName="Bg" Storyboard.TargetProperty="Opacity" To="1"/>
                                    <DoubleAnimation Duration="0" Storyboard.TargetName="IconPresenter" Storyboard.TargetProperty="Opacity" To="1"/>
                                    <DoubleAnimation Duration="0" Storyboard.TargetName="Presenter" Storyboard.TargetProperty="Opacity" To="1"/>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Rectangle
                        RadiusX="0"
                        RadiusY="0"
                        Fill="{TemplateBinding Background}"
                        Stroke="{TemplateBinding BorderBrush}"
                        StrokeThickness="{TemplateBinding BorderThickness}"/>
                    <Rectangle
                        x:Name="Bg"
                        RadiusX="0"
                        RadiusY="0"
                        StrokeThickness="0"
                        Opacity="0"
                        Fill="#11000000"/>
                    <Grid Margin="{TemplateBinding Padding}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                                Width="Auto"/>
                            <ColumnDefinition Width="2"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="17"/>
                        </Grid.ColumnDefinitions>
                        <ContentPresenter
                            x:Name="IconPresenter"
                            Content="{TemplateBinding Icon}"
                            Margin="1"
                            Opacity=".7"
                            VerticalAlignment="Center"/>
                        <ContentPresenter
                            x:Name="Presenter"
                            MinWidth="120"
                            Opacity=".7"
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Grid.Column="2"/>
                    </Grid>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

ZuneLikeContextMenuImplicitStyles.xaml.txt: XAML. Download all three in one file. The file contains both implicit styles plus defined style names.

Here’s a comparison, a screenshot of the Zune menu on the left, and my Silverlight 4 context menu on the right:

FinalContextMenus

Hope this helps you create some nice modern-looking Silverlight apps!

Categories: Blogs

Deep dive on Silverlight unit testing at Tech Ed next month

Tue, 05/11/2010 - 20:30

In about a month I will be presenting a 200-level session on Silverlight unit testing at Tech Ed North America in New Orleans. The talk will be an hour with questions, so you can arrive new to Silverlight testing and leave with all the tools you need to be successful in building high-quality applications with the right level of regression coverage that your management can smile about.

The session will be more comprehensive than the overview talk I presented at MIX 10 (which is available as a free online video stream now).

TechEd_2010

Click here to view the talk information on the Tech Ed site. The tentative information is as follows, but please double-check with the conference schedule builder before showing up:

Unit Testing in Microsoft Silverlight
Wednesday, June 9, 2010
11:45 AM – 1:00 PM
Room 287
Session Code WEB205
http://northamerica.msteched.com/topic/list?keyword=WEB205

Hope to see some friendly faces in the audience! I’ll be up there in some sort of speaker polo shirt uniform with khakis, apparently this conference isn’t quite as trendy and cool as MIX in Vegas ;-) .

If you’re going to be attending Tech Ed, I’d appreciate any early comments you have as there is still time to shape the content of the talk.

Categories: Blogs

Silverlight Unit Test Framework: New version in the April 2010 Silverlight Toolkit

Tue, 05/04/2010 - 00:26

In April we released a new version of the Silverlight Toolkit for targeting Microsoft Silverlight 4. This release contains a new version of the Silverlight Unit Test Framework. Key improvements come in user interface, Silverlight 4 support, and performance.

Rich, modern user interface

The user interface no longer uses the antiquated HTML DOM bridge for displaying results, but now is a data bound, rich Silverlight application itself.

NewTestFramework

Rich results information is available, and a tree view control allows you to select results to be included in a test report that can be copied to the clipboard. Failures are automatically selected.

The results pane includes information about the tests that ran, as well as detailed information for failures.

Descriptive text helps identify negative tests, known test issues and bugs, and other important metadata that was not always exposed in the previous test framework.

Integrated tag expression support

The startup experience now allows you to enter a tag expression to select which tests to run, or not to run. You can add the Tag(“”) attribute to any test methods or classes to define your own tags. Also, the full and short names of tests and classes implicitly become test tags, as well as priorities.

TagExpressionsEditor

This means that you can define tags such as:

!MyTest1 Run all tests except for the method named MyTest1 MyTest1+MyTest2 Run the MyTest1 and MyTest2 test methods Out of Browser support

The framework now supports running out-of-browser. Paired with the new Silverlight 4 Tools for Visual Studio 2010, you can press F5 to run a test project you have marked as an out-of-browser.

This also opens up an opportunity to do testing of elevated apps that make use of AutomationFactory and other advanced features on Windows.

Simplified dependencies

The test framework removed dependencies on System.Windows.Browser (from the platform) and System.Xml.Linq (XLinq, from the SDK).

Building blocks for Windows Phone testing support

This version also contains the full source to the phone testing interface, which is significantly different in visual design and experience to coincide with the Windows Phone device size.

However, the story for phone testing is still developing: in the meantime binaries designed for phone use can be found at http://jeffatmix.com/

New location for binaries

Since the new rich user interface contains a number of controls, the traditional design-time integration system conflicts and presents some issues.

As a result, we had to move the binaries from the Bin directory of the toolkit installation folder into a new Testing directory.

So the two test framework assemblies (Microsoft.Silverlight.Testing and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight) have moved.

This location change could cause existing applications that reference the test assemblies to fail to compile due to the "missing" references.

If that happens, please delete the two broken references and create references to these assemblies in their new location. Everything else should continue to work as expected.

Simplified test project template

In alignment with the test project changes in Visual Studio 2010, which are more simplified, the unit test project template for Silverlight no longer includes a README.TXT file.

Known issues Test service

I’ve received reports from a number of people about issues with the test service automation support. Some of the NDA/preview users of the framework reported issues that were corrected, but there may still be some bugs out there. I’m working to investigate and post a fix if and when I know more.

In the meantime I know that StatLight, a third party system, has been updated for the April release and is working well for automation.

Test panel and visuals

Please beware that some of your tests may need to be updated to use the new framework if your application, utility functions, or tests ever used the Application.Current.RootVisual (against the recommended pattern for interface testing).

The root visual is now the test framework application runner itself, and the tests run within the same TestPanel as before. Controls added to the test panel will not be located at the 0, 0 screen position, but likely near the bottom of the screen instead.

Hope this helps. To get started, download and install the April toolkit!

Categories: Blogs