Windows Application Testing(1,2,3)

来源:互联网 发布:男性网络基金产品 编辑:程序博客网 时间:2024/03/28 22:35

Windows Application Testing, Part I - API/Unit Testing

A Windows application is a non-Web based program which runs on a user's machine. Microsoft Excel is a good example of a Windows application. In general you can identify Windows applications because they usually have menu items File, Edit, View, and so on. Except for very simple programs, Windows application programs are composed of building blocks called DLLs (dynamic link libraries). The most fundamental type of Windows application testing is the process of testing these building blocks. This is usually called unit testing, or API testing. The idea is quite simple. If the individual building blocks of a software system are not correct, the system as a whole cannot be correct. For example, suppose developers are creating a cribbage game program. Behind the scenes there is likely to be a DLL which calculates the point value of various card combinations.

 

Windows Application Testing, Part II - Win32 Based UI Automation

A fundamental way to test Windows application programs is called UI (user interface) testing. Here a tester exercises the application under test by using it just as a user would -- through the application's use interface. UI testing can be performed manually. The tester launches the application under test, enters some input into the system (typically by typing information into text box controls and clicking on buttons), visually examines what happens to the application, determines a pass/fail result, and records the result (typically in an Excel spreadsheet). Manual testing is absolutely necessary but tends to be very tedious and inefficient. Automated UI testing is more efficient, but ends to be quite difficult. The tester writes a program which simulates a user exercising the application by calling into the Win32 API. This is a set of DLLs that make up the actual Windows operating system, but which can also be accessed by programmers.

Windows Application Testing, Part III - Reflection Based UI Automation

In my last entry I described how software test engineers can write UI automation which calls Win32 API functions. Using this technique is powerful but somewhat difficult. So difficult in fact, that there are many companies which write libraries using the technique and sell the product as a commercial test framework. Examples include Mercury, Segue, ParaSoft, and Rational (part of IBM). These commercial test frameworks are very expensive. However, in a Microsoft .NET environment, there is an alternative approach to UI automation. Windows applications which are .NET applications (meaning created with C# or VB.NET and which run on a Windows machine) can be tested using a technique called reflection-based UI automation. "Reflection" is a term that means a set of .NET methods which testers can use to access almost all aspects of a Windows application, including the user interface. It turns out using this technique to write UI automation is significantly easier than calling Win32 API functions