UI自动化 [英] UI automation

查看:130
本文介绍了UI自动化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我是UI自动化的新手。我有一个开源的UI自动化工具,我想为我的QA团队增强。

I am new to UI automation. I have a open source UI automation tool which I want to enhance for my QA team.

这个工具是使用Microsoft UI自动化API在C#中开发的。 

This tool is developed in C# using Microsoft UI automation APIs. 

现在问题在于:

假设我想使用此工具在测试用例下运行:

Suppose, I want to run below test cases with this tool:

1。最大化Windows桌面应用程序让我们说XYZ

1. Maximize a windows desktop application let's say XYZ

2。在该Windows应用程序中打开一个文件,例如file.txt

2. Open a file let's say file.txt in that windows application

3。关闭应用程序窗口

3. Close the application window

现在,在运行测试用例之前,对于每个测试用例,我必须提供控制信息。

Now, before running the test cases, for each of these test cases, I have to give control information.

例如对于第一和第三测试用例,我必须提供窗口标题和第二测试用例等控制信息,我必须提供打开按钮的控制信息,并发送file.txt的按键打开对话框。

For example, for 1st and 3rd test case, I have to give control information like window title and for 2nd test case, I have to give control information of open button and send keystrokes of file.txt to open dialog box.

我希望,你了解到目前为止的流程。

I hope, you understood the flow so far.

现在,我已经为第一和第三个测试用例设置了相同的控制信息。让我们说这一刻的Windows标题是<应用程序名称>

Now, I already set the same control information for 1st and 3rd test case. Let's say windows title for this moment was <application name>

但是当第二个测试用例运行时,这意味着当应用程序中的file.txt打开时,窗口标题会发生变化。

But when 2nd test case run, that means when file.txt opens in the application, window title changes.

它变成类似于 - < application name - file.txt>  

It becomes something like - <application name - file.txt> 

现在,当第三次测试运行时,它找不到窗口,因为在测试用例2中窗口标题已被更改。

Now, when third test runs, it does not find the window because window title has been changed in test case 2.

因此,我希望测试用例3无论如何都能检测到窗口。  ;

So, I want the test case 3 anyhow detect the window. 

我如何实现这一目标?

提前谢谢

祝你好运,

Navnath

 

推荐答案

您好,

感谢您的反馈。

我可以借助你的代码检测一个窗口。

I could detect a window with the help of your code.

然而,它无法在下面的测试序列中找到窗口案例:

However, it is not able to find the window in the below sequence of test cases:

1。打开一个新的记事本窗口。在这里,窗口将标题为无标题 - 记事本

1. Open a new notepad window. Here, window will have title Untitled - Notepad

2。更改窗口状态 - 最大化

2. Change window state - maximize

  &NBSP;对于这个测试用例,我设置了窗口的控件信息,标题为
无标题 - 记事本,因此它将最大化在测试用例1中打开的窗口

    For this test case, I have set the control information of the window with title Untitled - Notepad, hence it will maximize the window that is opened in test case 1

3。在测试用例1中打开的记事本中打开一个txt文件

3. Open a txt file in notepad that is opened in test case 1

现在,此时窗口的标题将被更改。它将类似于:

file.txt - 记事本

它将会为第4个测试用例创建一个问题

4。关上窗户。对于这个测试用例,我设置了新记事本窗口的控制信息,该窗口总是标题为
无标题 - 记事本

4. Close the window. For this test case I have set the control information of new notepad window which always has title of Untitled - Notepad

但是这一次,它会由于窗口标题已被更改,因此找不到该窗口。

But this time, it will not find that window since window title has been changed.

现在回答我的问题,有没有办法检测窗口使用一些正则表达式匹配。

例如,如果我说。* Notepad。* 那么它应该检测第4个测试用例中的窗口。

For example, If I say .*Notepad.* then it should detect the window in 4th test case.

提前谢谢!

Navnath


这篇关于UI自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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