在SIlverlight应用程序中用于用户控制.控件类型被认为是其在CUIT中的名称 [英] In SIlverlight application for user control. Control Type is consider as it's name in CUIT

查看:53
本文介绍了在SIlverlight应用程序中用于用户控制.控件类型被认为是其在CUIT中的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已经创建了Silver light示例应用程序(目标silverlight版本4并使用VS 2012)

I have create silver light sample application (Target silverlight version 4 and using VS 2012)

=== User Control Xaml ===     

< UserControl x:Class ="SilverlightApplication2.SilverLightUserControlForTest"
    xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d ="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable ="d"
    d:DesignHeight ="300". d:DesignWidth ="400">


    < Grid x:Name =" LayoutRoot"背景=绿色">
        < Button Content ="UserControlButton"";名称="UserTest"; Horizo​​ntalAlignment =左"保证金="95,149,0,0&". VerticalAlignment =顶部"宽度="132"/

    </Grid>
</UserControl>

<UserControl x:Class="SilverlightApplication2.SilverLightUserControlForTest"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">


    <Grid x:Name="LayoutRoot" Background="Green">
        <Button Content="UserControlButton" Name="UserTest" HorizontalAlignment="Left" Margin="95,149,0,0" VerticalAlignment="Top" Width="132"/>

    </Grid>
</UserControl>

==============================

===============================

********主应用程序XAML *******

********Main Application XAML*******

< UserControl
    xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d ="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc ="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk =" http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"x:Class ="SilverlightApplication2.MainPage"
    xmlns:Test ="clr-namespace:SilverlightApplication2"
    mc:Ignorable ="d"
    d:DesignHeight ="300". d:DesignWidth ="400".名称="TestMain" AutomationProperties.AutomationId ="100">

    < Grid AutomationProperties.AutomationId ="45">    

            < Test:SilverLightUserControlForTest x:Name ="Test"; x:Uid ="Gtt"/>.     
  </Grid> 
</UserControl>

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="SilverlightApplication2.MainPage"
    xmlns:Test="clr-namespace:SilverlightApplication2"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" Name="TestMain" AutomationProperties.AutomationId="100">

    <Grid AutomationProperties.AutomationId="45">    

            <Test:SilverLightUserControlForTest x:Name="Test" x:Uid="Gtt"/>     
  </Grid> 
</UserControl>

*************************************************** ******* .

******************************************************.

当我在Button上添加断言并以断言形式在被测应用程序中移动父项时. CUIT给出控件类型作为它的用户控件名称,即"SilverLightUserControlForTest".但在其他技术中,它可以与Pane一起使用.为了 更多详细信息,请参见图片

When I add Assertion on Button and  move parent in application under test in Assertion form. CUIT is giving Control Type as it's user control name i.e "SilverLightUserControlForTest" but in other technologies it is identifying with Pane. For more details see the image

这是预期的行为吗?

致谢,

Rajendar.

推荐答案

Visual Studio 2012编码的UI测试未正式支持Silverlight 4应用程序.参考:

Silverlight 4 application is not officially supported by Visual Studio 2012 Coded UI Test. Reference:

适用于编码的UI测试和操作记录的支持的配置和平台

我们需要使用适用于Silverlight的Microsoft Visual Studio UI测试插件: http://visualstudiogallery.msdn.microsoft.com/28312a61-9451-451a-990c-c9929b751eb4

We need use the Microsoft Visual Studio UI Test plugin for Silverlight: http://visualstudiogallery.msdn.microsoft.com/28312a61-9451-451a-990c-c9929b751eb4

我假设您已使用它针对Silverlight进行了编码的UI测试.根据您的图像,CodedUI可以很好地识别用户控件以及控件类型问题.我根据您的代码创建了此类Silverlight应用, SilverLightUserControlForTest不是用户控件的名称,它是用户控件的类的名称,并且用户控件的名称为null.您可以在VS中的用户控件属性中对其进行检查.

I assume that you have used it to do coded UI test against Silverlight. Based on your image, CodedUI can identify the user control well expect the control type issue. And I created such Silverlight app based on your code, I find SilverLightUserControlForTest is not the user control's name, it is the name of the class of the user control and the user control's name is null. You can check it in the properties of the user control in your VS.

我怀疑编码UI是否可以正确识别用户控件,但我不知道编码UI将控件类型识别为用户控件类名称的原因.也许是因为 SilverLightUserControlForTest继承自UserControl类.为了确认 我建议您应通过单击该页面上的问与答"标签并开始讨论来咨询该页面上的问题.

I doubt that Coded UI identifies the user control correctly but I don't know the reason why Coded UI identifies the control type as the name of the class of the user control. Maybe it is because the SilverLightUserControlForTest is inherited from UserControl class. In order to confirm it, I suggest you should consult your issue on that page through clicking ‘Q AND A’ tab on that page and starting a discussion.

感谢您的理解.

最好的问候,


这篇关于在SIlverlight应用程序中用于用户控制.控件类型被认为是其在CUIT中的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆