Introduction to some technologies based on Windows automated testing tools (note)

Source: Internet
Author: User

Gui: user graphical interface.

 

1. Windows API

Findwindow and enumwindows can be used to find the window handle.

Getwindowtext, getwindowrect, and getwindowlong can be used to obtain window attributes.

Setwindowtext and getwindowtext can be used to operate the text displayed on the control.

Setforegroundwindow is used to set the top-level window.

Getforegroundwindow is used to obtain the current top-level window.

Getactivewindow

Setactivewindow

...

Advantage: The standard Windows controls are well supported, compared with the underlying ones.

Disadvantage: The underlying layer is complicated and requires multi-layer encapsulation. It is inefficient in development and fully dependent on Windows APIs. It is difficult to automate non-standard (custom) controls.CodeUnstable, and the cost of maintenance and analysis results is also high.

 

2. msaa -- Microsoft Active accessibility

Iaccessible is a COM component. The most important thing is that the method provided by its interface can obtain more detailed information about the control, or perform simple operations on the control through some methods.

Advantage: users only need to deal with iaccessible. The control information obtained through this interface is relatively rich, and basic operations do not need to be implemented through windows message. Another major advantage is the support of custom controls. When developing a custom control, you can implement the iaccessible interface and expose some attribute operations through this interface. The tester can use this control as a standard control and use msaa for automation.

Disadvantage: it is not designed for automated testing. The obtained control information is more than that of Windows APIs, but it is still not enough for automated testing. Only one basic operation is supported, and other operations still require Windows message.

 

3. uiautomation

In architecture, UIA calls the msaa server through UI automation proxy for standard controls, basically covering the msaa function.

Ui spy is a UIA tool.

Compared with msaa:

1) tree. Broken exception, improving maintenance costs

2) It can only be written in. Net Language and run in. Net managed heap-> performance difference

3) msaa supports in-process operations

UIA is not supported and may have performance problems.

4) supported Custom Controls

 

4. Window Automation API 3.0

Upgrade UIA and msaa.

Windows 7 provides better support for automated testing. Managed code and unmanaged code can be used to solve the above UIA problems.

Managed code vs unmanaged code ):

Outside the public Language Runtime Library environment, the Code directly executed by the operating system is called unmanaged code. It must provide its own garbage collection, type check, security support, and other services, unlike managed code, the latter obtains these services from the public Language Runtime Library, rather than the code that runs outside the Runtime Library. For example, COM components, Active X interfaces, and Win32 APIs are examples of unmanaged code.

 

The essence of automated testing is to quickly and efficiently discover and prevent regression defects, rather than discovering new defects (except test monkey ). It is designed to solve cost problems.

 

Uiautomation cannot generate mouse or Keyboard Events-> win APIs available

 

Ui spy usage:

Focus tracking, hover, pay attention to run as admin, you can get the following content:

1) UI items and UI automation property values

2) control mode implementation

3) UI automation event information

4) Navigation and keyboard focus

 

Note that there will be two processes in IE 8 or later versions. The main process is large and used for browsing web pages. The minor process is the auxiliary process, which is used to restore and reopen webpage errors.

 

From the perspective of UI testing automation, it means that the tested applicationProgramCalled a server, the test tool is considered as a client.

The uiautomationclient. dll library is actually the test automation library used by the UI automation client.

The uiautomationtypes. dll library contains various types of definitions used by uiautomationclient. dll and other automated server libraries.

Uiautomationclientsideprovider. dll contains a set of code that is used with components that do not support automation at the time of building. These controls may include legacy controls and custom. Net controls.

The uiautomationprovider. dll library is a set of interface definitions that can be used by developers who create custom UI controls and want them to be accessed by the UI automation library.

 

Treasure is an enumeration type:

Element, children, descendants, parent, ancestors, and subtree (including the search root and all child generations)

 

System. Windows. Automation. andcondition represents a condition

System. Windows. Automation. notcondition

System. Windows. Automation. orcondition

System. Windows. Automation. propertycondition test whether the property has a specified value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.