locked
CodedUITest property generated different depending of Pc's language RRS feed

  • Question

  • Hi,

    I'm encoutering an issue while trying to record a CodedUI Test over a very simple WPF application which looks like this :

    <Window

            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="WpfApplication2.MainWindow"

            Title="MainWindow" Height="350" Width="525">

      <Grid Margin="0,0,2,0">

        <telerik:RadTabControl HorizontalAlignment="Stretch" Margin="14,27,0,10" VerticalAlignment="Stretch">

          <telerik:RadTabItem Header="Tab1" Content="abc"/>

          <telerik:RadTabItem Header="Tab2" Content="abc"/>

        </telerik:RadTabControl>

      </Grid>

    </Window>

    I'm using a windows 8.1 Workstation. If the language English (US) is used as the Windows display language, when I try to perform an assertion on the RadTabControl, the ItemStatus property contains the following generated string, which seems correct :

    ... <Property Name="SelectedValue" Value="Telerik.Windows.Controls.RadTabItem Header:Tab1 Content:abc" /> ...

    In another hand, if the language pack French (Switzerland) is used, with the exact same application and the exact same assertion, the generated string looks like this :

    ... <Property Name="SelectedValue" Value="Telerik.Windows.Controls.RadTabItem Header : Tab1 Content : abc" /> ...

    We can notice the whitespaces added before and after the column character.

    The issue with this behavior is that if we record a CodedUI Test on machine with English (US) settings, and playback on a machine with French (Switzerland) settings, the assertion will fail.

    Can someone please look into this issue ?

    Thanks in advance.

    -Vince


    -Vince

    Tuesday, November 25, 2014 10:48 AM

All replies

  • Hi Vince,

    I assume that you added assertion on the ItemStatus property of the RadTabControl but the ItemStatus property’s value is a little different based on the language of your computer, which will cause the test fail.

    In order to avoid such issue, I suggest writing your own code in coded UI test method to make this assertion with the correct ItemStatus property value. You can use environment variable to distinguish the test environment. Please see:How To: Get same test running under different environments

    The code may look like this:

    UITestControl control=xxx.yyy.zzz;//define the RabTabControl

    Control.SearchProperties.Add…//use search properties to locate the control

     string testServer =

            Environment.GetEnvironmentVariable("TestServer");

    If (testserver is server with english language)

    Assert.AreEqual(control.itemstatus, “<Property Name="SelectedValue" Value="Telerik.Windows.Controls.RadTabItem Header:Tab1 Content:abc" />”)

    If (testserver is server with switzerland language)

    Assert.AreEqual(control.itemstatus, “<Property Name="SelectedValue" Value="Telerik.Windows.Controls.RadTabItem Header : Tab1 Content : abc" />”);

    About how to write your own coded UI test, this blog can help you: Hand-coding a Coded UI Test

    Thanks,

    Or you can make a logic in the UIMap.cs file for the recorded expected itemstatus value based on the server language to use corresponding value in different environment instead of hand coding your coded UI test. Please see ‘Map Refactor control and edit and rerun the coded UI test’ section in this document: Walkthrough: Creating, Editing and Maintaining a Coded UI Test

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Amanda Zhu Friday, November 28, 2014 9:54 AM
    Wednesday, November 26, 2014 3:31 AM
  • Txs for this suggestion but we don't consider it as a definitive response.

    We hope there are maybe another more technical reasons to explain this behavior.

    Txs 

    -vince


    -Vince

    Friday, November 28, 2014 10:43 AM
  • Hi Vince,

    Please use Inspect.exe(http://msdn.microsoft.com/en-us/library/windows/desktop/dd318521(v=vs.85).aspx ) to get the value of ItemStatus property of RadTabControl control and check whether the value is <Property Name="SelectedValue" Value="Telerik.Windows.Controls.RadTabItem Header : Tab1 Content : abc" /> instead of <Property Name="SelectedValue" Value="Telerik.Windows.Controls.RadTabItem Header:Tab1 Content:abc" />.

    If yes, then the issue is not on Coded UI Test and probably this behavior is related to Telerik RadTabControl itself. If that is the case, I suggest consulting on Telerik developer forum: http://www.telerik.com/forums  to check why the value ItemStatus property of RadTabControl will change based on the PC’s language.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Amanda Zhu Monday, December 8, 2014 7:37 AM
    Monday, December 1, 2014 5:53 AM
  • Hi Vince,

    If I misunderstood you, please feel free to come back.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, December 4, 2014 8:48 AM