UI测试在UI控件之间混淆 [英] UI Testing gets confused between UI controls

查看:62
本文介绍了UI测试在UI控件之间混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我正在使用UI测试构建器(Microsoft工具)自动化我的测试(基于UI)..其中一个测试用例涉及打开一个文件,在输入文件路径后,它点击打开按钮..我可以上传图像以获得更好的可视化,如果MSDN可以
验证我的帐户..我用来打开文件的功能在下面的代码中给出...



 

i am using UI Test builder (Microsoft tool) to automate my testing (UI based).. one of the test cases involves opening a file where after typing the path to the file, it clicks on open button.. i can upload the image for better visualisation if MSDN could verify my account.. the function i am using to open the file is given in the code below...

public void FileOpenOfflineAutoTest(string file)
        {
            #region Variable Declarations
            WpfButton uIM_openFileBtnButton = this.UIQACTWindow.UIM_launcherCustom.UIM_openFileBtnButton;
            WinComboBox uIFilenameComboBox = this.UIOpenAFileWindow.UIItemWindow.UIFilenameComboBox;
            WinSplitButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenSplitButton;
            //WinButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenButton;
            #endregion

            // Launch '%LOCALAPPDATA%\Qualcomm\QACT 7.0\QACTLauncher.exe'
            ApplicationUnderTest uIQACTWindow = ApplicationUnderTest.Launch(this.FileOpenOfflineParams.UIQACTWindowExePath, this.FileOpenOfflineParams.UIQACTWindowAlternateExePath);

            // Click 'm_openFileBtn' button
            //Mouse.Click(uIM_openFileBtnButton, new Point(146, 104));
            Mouse.Click(uIM_openFileBtnButton);

            // Select 'C:\vaman automation\trial1\QACT_UI_AutoTest\ACDBs\MSM8998_LA.1.0_ACDB\MTP_WorkspaceFile.qwsp' in 'File name:' combo box
            //uIFilenameComboBox.EditableItem = this.FileOpenOfflineParams.UIFilenameComboBoxEditableItem;
            uIFilenameComboBox.EditableItem = file;

            // Click '&Open' split button
            // Mouse.Click(uIOpenSplitButton, new Point(35, 12));

            while (!uIOpenSplitButton.TryFind())
            {
                uIOpenSplitButton.Find();
            }
            uIOpenSplitButton.EnsureClickable();
            Mouse.Click(uIOpenSplitButton);
        }

这里的问题是:¥b $ b

1.有时开放控制被识别,有时它不在同一台机器上。



2.有时它会在一台机器上被识别,有时它在其他机器上无法识别。



3.有时打开按钮控件与分割按钮控制混淆(图像中的QACT / acdb文件按钮) )。也就是说,它点击了拆分按钮而不是打开按钮。



4.拆分按钮控制 



WinSplitButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenSplitButton;



给出比打开文件按钮控件更积极的结果来打开文件。 



WinButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenButton;



$


上述行为都不一致也不可预测,这很奇怪。当这些发生时,我无法得出结论。因此,我的测试用例是通过/失败而不保证..



非常感谢任何帮助。

the problems here are:

1. sometimes the open control gets recognised, sometimes it doesn't on the same machine.

2. sometimes it gets recognised in one machine, sometimes it doesn't get recognised in other machine.

3. sometimes the open button control gets confused with split button control (QACT/acdb files button in the image). That is, it clicks on splitbutton instead of open button.

4. Splitbutton control  

WinSplitButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenSplitButton;

gives more positive results than open file button control for opening the file. 

WinButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenButton;



None of the above mentioned behaviors is consistent nor predictable which is quite weird. I haven't been able to come up with a conclusion when which of these happens. As a result, my test case is passing/failing with no guarantee..

Any help is really appreciated.

推荐答案

vaman,

>> 1。有时开放式控件会被识别,有时它不在同一台机器上。

<跨度>&NBSP; >大于2。有时它会在一台机器上被识别,有时它在其他机器上无法识别。

 >>2. sometimes it gets recognised in one machine, sometimes it doesn't get recognised in other machine.

要解决此问题,请确保我们能够找到正确的控件。由于您身边的两个控件属于同一类型,因此
按钮。我建议你可以使用它的独特属性搜索按钮,如"Id",如果它有一个。

To solve this issue, please make sure that we could find the correct control first. As the two controls in your side are same type, button. I suggest you could search the button by using its unique properties, like "Id", if it has got one.

还请确保控件可以显示完全,并且在运行测试时不会隐藏任何部件。因为这可能无法正确识别控件。

And please also make sure that the control could be shown completely, and no part is hidden when you run the test. Because the control might not be recognized correctly due to this.

我在您的代码中添加了一些 searchproperty()方法,我认为您的控件具有"id", 
然后你可以用真正的"Id"完成方法。   代码如下:

I’ve added some searchproperty() method in your code, and I assume your controls have "id",  then you could finish the method with the real "Id".  The code is like below:

 public void FileOpenOfflineAutoTest(string file)
        {
            #region Variable Declarations
            WpfButton uIM_openFileBtnButton = this.UIQACTWindow.UIM_launcherCustom.UIM_openFileBtnButton;
            WinComboBox uIFilenameComboBox = this.UIOpenAFileWindow.UIItemWindow.UIFilenameComboBox;
            WinSplitButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenSplitButton;
            //WinButton uIOpenSplitButton = this.UIOpenAFileWindow.UIOpenWindow.UIOpenButton;
            #endregion

            // Launch '%LOCALAPPDATA%\Qualcomm\QACT 7.0\QACTLauncher.exe'
            ApplicationUnderTest uIQACTWindow = ApplicationUnderTest.Launch(this.FileOpenOfflineParams.UIQACTWindowExePath, this.FileOpenOfflineParams.UIQACTWindowAlternateExePath);

            // Click 'm_openFileBtn' button
            //Mouse.Click(uIM_openFileBtnButton, new Point(146, 104));

            
            uIM_openFileBtnButton.SearchProperties.Add("Id", "");

            Mouse.Click(uIM_openFileBtnButton);

            Playback.Wait(2000);

            // Select 'C:\vaman automation\trial1\QACT_UI_AutoTest\ACDBs\MSM8998_LA.1.0_ACDB\MTP_WorkspaceFile.qwsp' in 'File name:' combo box
            //uIFilenameComboBox.EditableItem = this.FileOpenOfflineParams.UIFilenameComboBoxEditableItem;
            uIFilenameComboBox.EditableItem = file;

            // Click '&Open' split button
            // Mouse.Click(uIOpenSplitButton, new Point(35, 12));

         

            uIOpenSplitButton.SearchProperties.Add("Id", "");

           

            while (!uIOpenSplitButton.TryFind())
            {
                uIOpenSplitButton.Find();
            }

            
            uIOpenSplitButton.EnsureClickable();
            
            Playback.Wait(2000);

            Mouse.Click(uIOpenSplitButton);

        }
    }

祝你好运,

Fletch


这篇关于UI测试在UI控件之间混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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