Software QA FYI - SQAFYI

SilkTest Extension Kit for .NET

By:

This manual provides all the information you need to work effectively with the SilkTest Extension Kit for .NET.

Planning the extension
The Infragistics UltraWinToolbars application is not part of the SilkTest installer. You must download a trial version from http:// www.infragistics.com. This tutorial supports any version of the UltraWinToolbars application. You may have to update the project file for your version.

This tutorial was built using Microsoft’s 1.1 .NET Framework
Procedure To support your version of the Ultrawin toolbar
1 Open the project file (infra_toolbar.vcproj) using a text editor. If you open it using Microsoft’s Visual Studio .NET, you may receive an error message that 'Project <project> failed to open'. The project file is provided in the Extension Kit directory under ekwin32\tutorial\dotnet\infra_toolbar.
2 Update the references to the version of the Ultrawin toolbar. The references are contained in the <AssemblyReference> tags within the <References> tag, and refer to Infragistics DLLs:
3 Open the project in Microsoft’s Visual Studio .NET and rebuild the .dll.

Infragistics UltraWinToolbars sample application
The Infragistics UltraWinToolbars sample application and the Extension Kit DLL must be built using the same version of Microsoft’s .NET FrameWork. The Extension Kit DLL example was built using Microsoft’s 1.1 .NET Framework, so you must make sure that the Infragistics UltraWinToolbars sample application is also built with the 1.1 version of the Framework. If the Framework versions differ, the LoadLibrary() call, which SilkTest uses to map the DLL module into the address space of the .NET application, will fail. See the “LoadLibrary” online help topic for more information. The application contains multiple toolbars that contain three powerful components that enable you to build rich user interfaces in your applications. The UltraWinToolbars component is designed to display and manage Microsoft Office style toolbars and menus. It also has an enhanced status bar component plus a dockable windows component which makes it easy to add a Microsoft Visual Studio.NET style dockable, tabbed windows interface to your application.

The Toolbar window contains multiple toolbars that contain different UIElements.

To familiarize yourself with the Infragistic UltraWinToolbars application:
1 Download the trial version of the UltraWinToolbars application from http://www.infragistics.com.
2 Start the UltraWinToolbars application.
3 Click on some of the toolbar objects.

What to test
To test the application, you need to perform actions and retrieve information that a user might perform or retrieve manually. A few examples are:
• Click on a toolbar button.
• Retrieve the names of the items in the specified toolbar.
• Retrieve the number of items in the toolbar.

Add a method: GetCount
In this tutorial, you will write an extension to retrieve the number of items in the toolbar. This extension supports a new 4Test method which you will name GetCount. This method takes no arguments, and it returns an integer which is the number of objects in the toolbar.
Writing a 4Test include file
A complete extension consists of external functions written in C and declarations for the corresponding 4Test methods in a 4Test include file. The 4Test include file enables your 4Test scripts to call these external functions asmethods to your custom class.
Writing a window class definition
You need to write a window class definition for the UltraWinToolbar sample that contains the new class methods that your extension implements. The simplest way to define a window class is to derive it from an existing class. The UltraWinToolbar window is similar to the existing CustomWin class, so you should derive your custom class from that.
Procedure To write a window class definition:
1 Start SilkTest (if it is not already running).
2 Open a new 4Test include file in the editor window.
3 Type the following into the include file:
winclass UltraWinToolbar : CustomWin
extern integer GetCount()

This declaration defines a class called UltraWinToolbar, which is derived from the built-in 4Test class CustomWin. It inherits all of the methods and properties of the CustomWin class, plus any methods that you add. The GetCount function is declared inside the window class definition using the extern keyword. The extern keyword indicates to 4Test that the function is implemented in an external extension rather than in a 4Test script.
4 Save this file as UltraWinToolbar.inc and minimize SilkTest.
Example
For a more advanced example of an extension for the UltraWinToolbar class that includes window declarations and a testcase for the sample application, see the test script 'infratoolbar.t' that is provided in the ekwin32\tutorial\dotnet\infra_toolbar directory in your Extension Kit directory.
Understanding the UltraWinToolbar project
The “assist” library allows your extension to communicate with the SilkTest Agent. You need to link this library with your C or C++ project.
Preparing to write the extension
SilkTest comes with a header file that contains function prototypes for SilkTest functions, data structures that will be used by your extension functions, and some useful macros. To see the header file:
1 Open segUltraToolbar.cpp in the ekwin32\tutorial\dotnet\infra_toolbar directory in your Extension Kit directory. 2 The header file information is placed below the comment /*** include EK header files here ***/. In this case, you see: #include "qapwinek.h" Preparing to build the extension The “assist” library comes set up to communicate with the Agent and with include directories. To see how this is set up: 1 Open the project file using Microsoft’s Visual Studio .NET. The project file is provided in the Extension Kit directory under ekwin32\tutorial\dotnet\infra_toolbar. 2 Select Project/Properties from the main menu bar. 3 Select Linker/Input from the tree view in the Property Pages dialog and find the line “Additional Dependecies”. The assist.lib file is listed below that in the format: “$(SEGUE_HOME)\ekwin32\assist.lib” 4 Select C/C++ from the tree view in the Property Pages dialog and find the line “Additional Include Directories”. You will see Infragistics’ include directory listed in the format: “$(SEGUE_HOME)\ekwin32” 5 Save and close the project file.

Full article...


Other Resource

... to read more articles, visit http://sqa.fyicenter.com/art/

SilkTest Extension Kit for .NET