Silk Test Automation Testing Tool- An Introduction (I)

June 9th, 2009 admin Posted in Catch The Latest | 3 Comments »

By Parul Wahi

Borland silk test is a leading tool for functional and regression, cross platform and localization testing. It can test application based on vast set of technologies like Java, .Net , web , active x, adobe Flex ,client server  etc. Silk Test’s powerful testing framework enables high reusability of test scripts across test projects, building and maintaining regression testing suites and thus helps in expanding test coverage and optimize application quality.

Silk Test Features

A single, automated functional testing tool tests a broad range of enterprise technologies and environments—without costly connectors, adaptors or add-ins
•    A wizard-driven toolbar workflow enables novice users to develop useful tests quickly
•    Robust, resilient tests are supported by a flexible, object-oriented, fourth-generation scripting language called 4Test is designed expressly for automated testing
•    Silk Test also offers functionality of test case management, test planning, data base function, date time functions etc. to make your automation more effective.
•    Silk Test offers many features such as basic workflow for recording tests, workflow for linking a single test case to test data values stored in external tables and code completion in the SilkTest IDE .
•    Unicode support allows localization testing of global applications on multiple platforms with a single script
•    A built-in, customizable error-recovery system returns systems to pre-failure state and resumes testing, unlike other tools that leave systems unstable with unexecuted tests
•    TrueLog based visual reports simplify problem diagnosis when you find defects
•    Integration with Borland’s software test management tool delivers enhanced management capabilities that support a mature and complete functional and regression testing process
•    Built-in support for testing Adobe Flex applications using Internet Explorer, Firefox, the Standalone Flex Player, and Adobe AIR
•    Animated Run Mode to provide ‘slow motion’ playback of test scripts

Architecture

Silk Test consists of two distinct components that execute in separate
processes:
• The Silk Test Host software
• The Silk Test Agent software

The SilkTest Host

The host software is the SilkTest component you use to develop, edit, compile, run and debug your test scripts and testplans. The machine that runs this component is often referred to as the host machine.

The SilkTest Agent

The SilkTest Agent is the component of SilkTest that interacts with the GUI of your application. The Agent translates the commands in your 4Test scripts into GUI specific commands, driving and monitoring the application you are testing. The Agent can run locally on the same machine on which the Host is running or, in a networked environment, any number of Agents can run on remote   machines. In a networked environment, the machine that runs the Agent is often referred to as the remote machine.

How SilkTest  Works and records user actions

Applications are composed of graphical user interface (GUI) objects such as windows, menus and buttons that a user manipulates using a keyboard and a mouse to initiate application operations. Silk Test interprets these objects and recognizes them based on the class, properties and methods that uniquely identify them. During testing, Silk Test interacts with the objects to submit operations to the application automatically, simulating the actions of a user, and then verifies the results of each operation. The simulated user, Silk Test, is said to be driving the application.

Before you begin creating and running test scripts, you create a repository of information about your application to be used by Silk Test. This repository includes descriptions of the GUI objects that comprise your application.Based on the properties and methods Silk Test associates with these objects, Silk Test can recognize the actions performed on them and intelligently record those actions into your test script using the 4Test language.

Test automation is normally developed in SilkTest host using either record/playback or by manual scripting using 4Test. Normally, test cases for SilkTest are developed in IDE (Integrated Development Environment) provided by SilkTest host software. Executing automated test suite is the responsibility of SilkTest agents. SilkTest even supports parallel execution of test cases with the help of these agents. SilkTest host can communicate with these agents residing on multiple machines and execute automated test cases on multiple machines simultaneously. Example , if you need to test your application on Windows 2000, Windows XP and Windows 2000 SP 2, you can have SilkTest agent installed on these machines and run automated test suite in parallel on all these machines at once. Feature like this, saves precious execution time for the testers.

In the next series we will discuss the testing process of silk test and will learn to create simple 4test scripts.

(to be continued…)


AddThis Social Bookmark Button




Testing Ajax Application using QTP

April 24th, 2009 admin Posted in Quick Test Professional | 7 Comments »

By Parul Wahi

What is Ajax?

Ajax, short for Asynchronous JavaScript and XML, is a web development technique for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user makes a change. This is meant to increase the web page’s interactivity, speed, and usability.

Testing Ajax is different and difficult

In traditional web applications, the HTML elements are already loaded in the web pages which have been fairly easy to test in an automated fashion. Unfortunately, AJAX-based web applications are not as easy or consistent to test as the traditional web applications. The problem with AJAX testing is that the web page under test will be modified asynchronously such as an element will be dynamically added based on a check box click or an element will be removed based on a list element selection, etc. 

Synchronization issues are also there. Clicking a link will not cause a page reload; instead the browser will converse with the server and refresh just a part of current page. The time delay between clicking a link and seeing the results is what makes things tricky.

Due to the asynchronous nature of the Ajax the result doesn’t come back from the server immediately. The result from server takes time but the automation tools would check the results immediately. In case of Ajax .sync and WaitProperty also doesn’t provide correct results.

Testing Ajax technology using QTP

QTP 9.5 provides the facility of testing Ajax objects. For testing Ajax objects using QTP 9.5 Web Extensibility toolkit should be installed. This will cause a mini Ajax add-in to show up besides the web add-in in the Add-in manager dialog. After installing WEB Add-in Extensibility kit, check both web and Ajax addins in addin manager and then try recording the scripts.

Still using QTP 9.2 and earlier versions? 

QTP 9.2 and previous version doesn’t support Ajax technology. But one can use DOM approach to handle Ajax applications. DOM seems to be the best option available.  

Let’s study one example:

There are some text fields on a page, having auto complete feature i.e. as we key-in the characters in the text-box, the application fetches the matching results and displays them in the pop-up area below the field. The required record from the results shown in the pop-up is then selected.

Now at the time of recording these actions, QTP records the step of entering the characters in the field. However it doesn’t record the step of mouse click over a record in the pop-up results or maybe record it as webelement.

Solution:

Generally such pop-up results are created on the fly as characters are typed in the text-field, using Ajax technique. The best thing that works for such scenarios is DOM. Usually such results are created dynamically within <SPAN>, <DIV> or <TD> elements.

These objects can be identified by an automation script using following four parameters:

1. Name of the page on which the object exists

2. HTML tag of the object e.g. INPUT, TD, DIV, SPAN

3. Name of a property of the object that can be used to identify the object uniquely from among the other objects of same type on the page.

(For hyperlink type of object it can be the “innertext” or “href” property, for table cell, it can innertext, for list-box it can be Id, name or innertext. Some objects can be identified uniquely by their innerHTML, or outerHTML. )

4. Value of the above property i.e. “txt_FirstName” (if Name property is used) or “txt_FirstNameId” (if ID property is used)

The idea is to identify the element TAG in which selected item from the  popup is stored is and displayed, whether it is in DIV tag, SPAN tag TD tag, Font tag etc and check the outerHTML of the element and see if there is any onmouseover/onclick/onchange event declared for the object. Then trigger the OnMouseover event for the result item to be selected, Bring mouse over the result item to be selected and then trigger the onclick event for the result item to be selected.

This approach uses the Document Object Model (DOM) of web-page to recognize objects on the page, access their properties to perform any action/operation on the web-objects. This approach is useful for automation of web-based apps and requires a good understanding of HTML, DOM and VBscript.

The object which can’t be accessed using DOM, for recognizing them use of Descriptive Programming feature of QTP is recommended.


AddThis Social Bookmark Button




How to Execute QTP script from Command Prompt using Automation Object Model

September 8th, 2008 admin Posted in Quick Test Professional | No Comments »

By Parul Wahi

In order to run QTP scripts on schedule, we can run them directly from command line.

In order to do so we can make use of QTP Automation Object Model which can help us in automating QuickTest operations. Using the objects, methods, and properties exposed by the QuickTest automation object model, we can write scripts that configure QuickTest options and run tests instead of performing these operations manually using the QuickTest interface.

In the following code we are trying to execute a QTP script called “Google_search” from command line. Let’s create a script in QTP and save it as Google_search.Write the following code in a vbs (VB Script) file as save it as demo.vbs:

Dim qtApp ‘ Declare the Application object variable

Dim qtTest ‘ Declare a Test object variable

Dim qtResultsOpt ‘Declare a Run Results Options object variable

Set qtApp = CreateObject(”QuickTest.Application”) ‘ Create the Application object

qtApp.Launch ‘ Start QuickTest

qtApp.Visible = True ‘ Make the QuickTest application visible

qtApp.Open “C:\Documents and Settings\pwahi\Desktop\Google search“, True ‘ Open the test in read-only mode

‘ set run settings for the test

Set qtTest = qtApp.Test

qtTest.Run’ Run the test

WScript.StdOut.Write “Status is:” & qtTest.LastRunResults.Status ‘ Check the results of the test run

qtTest.Close ‘ Close the test

Set qtTest = Nothing ‘ Release the Test object

Set qtApp = Nothing ‘ Release the Application object

Now in order to execute QTP script from command line we have to execute the above created vbs file from command prompt which will in turn launch QTP, open the script, run it and will display the result in command prompt only. Open command prompt and write following code:

C:\Documents and Settings\pwahi\Desktop>cscript //nologo demo.vbs

And press enter

This command will execute the demo.vbs file which in turn launch QTP, open the script Google search, execute it and will display the result in QTP result file. We can also see the results in command prompt as shown below.

If the script passes the result is declared in command prompt as follows:

Status is: Passed


AddThis Social Bookmark Button




How to Access Command prompt from QTP

September 8th, 2008 admin Posted in Quick Test Professional | No Comments »

By Parul Wahi

We can even access Microsoft Windows command prompt also known as MS-DOS from QTP interface.cmd.exe is a 32-bit command prompt used in Windows NT, 2000 and XP and offers disk and file maintenance functions as well as network functions. It can be found under System32 folder.

To launch cmd.exe from QTP write :

SystemUtil.Run  “cmd.exe”, “”, “c:\WINDOWS\system32”,”open”

Once DOS window launches, this window can be leant and added to object repository

To write on command prompt window use the following code:

Window( “object class:=ConsoleWindowClass”).Type “Ping crestechsoftware.com”

Window( “object class:=ConsoleWindowClass”).Type micReturn

Using WshShell object

The WshShell object gives your scripts the ability to work with Windows shell .Your scripts can use the WshShell object to perform a number of system administration tasks, including running programs, reading from and writing to the registry, and creating shortcuts.

Following are the list of few methods used with wcript object:

1)The Environment property helps in getting  environment variables

2)The Exec method returns a WshScriptExec object, which provides status and error information about a script run with Exec along with access to the StdIn, StdOut, and StdErr channels. The Exec method allows the execution of command line applications only.

3)Pop Up Method Displays text in a pop-up message box.

4)RegRead Method helps in reading from registry

Example

The following example demonstrates the basics of the Exec method.

Dim WshShell, oExec

Set WshShell = CreateObject(”WScript.Shell”)

Set oExec = WshShell.Exec(”calc”)

Do While oExec.Status = 0

WScript.Sleep 100

Loop

WScript.Echo oExec.Status


AddThis Social Bookmark Button




Descriptive Programming in QTP

August 14th, 2008 admin Posted in Quick Test Professional | 15 Comments »

By Parul Wahi

What is Descriptive Programming?

QTP can perform some action on objects at run time only when it is able to uniquely identify the object. In order to identify the object at run time (play back), QTP learns some physical properties of the object at the time of recording and stores them in object Repository (OR). When QTP runs the script, it compares these properties and values to the actual objects appearing in the application, and performs the action on the object if it finds it.

Thus, it is not possible for QTP to perform action on objects during run time if the objects are not there in OR. But descriptive programming provides a way to perform action on objects which are not in Object repository. We can instruct QTP to perform methods on the objects that are not there in object repository with the help of programmatic description or descriptive programming.

When and Why to use Descriptive programming?

When using Descriptive Programming (DP), we’re bypassing the native object repository (OR) mechanism which may have many advantages. Let’s examine the situations in which the OR’s advantages are outweighed by the DP.

Suppose we are testing the site that displays the list of users whose details matches with the search criteria that is entered in search text field. With the names, the application also displays checkboxes against each name. Now, we want to test the scenario where application sends mail to all the users whose names are displayed in the list. But we are not sure  how many check boxes will be displayed on the page as the search criteria can differ . In this situation, you can use a programmatic description to instruct QuickTest to perform a Set “ON” method for all objects that fit the description: HTML TAG = input, TYPE = check box

The other usage of DP can be as follows:

1) Programmatic descriptions can be used to perform the same operation on several objects with certain identical properties, or to perform an operation on an object whose properties match a description that is determined dynamically during the run session.

2)  One place where DP can be of significant importance is when you are creating         functions in an external file. You can use these function in various actions directly, eliminating the need of adding object(s) in object repository for each action [If you are using local  object repository]
3)  The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <username>”.

4)  When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object.

5)  When you don’t want to use object repository at all.  Consider the following scenario which would help understand why not Object repository

Scenario 1: Suppose we have a web application that has not been developed yet.Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing

Scenario 2: Suppose an application has 3 navigation buttons on each and every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow this would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository we can just write 3 descriptions for the object and use it on any page.

6) When you want to take action on similar type of object i.e. suppose we have 20 textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a good programming approach.

How to use Descriptive programming?

There are two ways in which descriptive programming can be used
•    Static. You list the set of properties and values that describe the object directly in a VBScript statement.
•    Dynamic. You add a collection of properties and values to a Description object, and then enter the Description object name in the statement.

Static method
In Static method , we can write down the physical description of the object in the script itself rather than using it’s logical name. The syntax for this is :
TestObject(”PropertyName1:=PropertyValue1″, “PropertyName2:= PropertyValue2″)
Where, TestObject is . The test object class. Eg WinButton , WebEdit , WinCheckBox etc
PropertyName:=PropertyValue. The test object property and the value identification string.                    Each property:=value pair should be separated by commas and quotation marks
Eg.1 DP code for login into the FLIGHT RESERVATION (sample Application of QTP) is :
Dialog(”text:=Login”).WinEdit(”nativeclass:=Edit”,”attachedtext:=Agent Name:”). Set “fgfdgfdgf”
Dialog(”text:=Login”).WinEdit(”nativeclass:=Edit”,”attachedtext:=Password:”).SetSecure “48a1881a08961df276749334f4511d5a7d35e922″
Dialog(”text:=Login”).WinButton(”text:=OK”,”nativeclass:=Button”).Click
Window(”title:=Flight Reservation”).Close
Dynamic Method

QTP provides another method which provides more efficiency, power and flexibility known as Dynamic method.

Under Dynamic method you can use the Description object to return a Properties collection object containing a set of Property objects. A Property object consists of a property name and value. You can then specify the returned Properties collection in place of an object name in a statement.

Eg2. The first example mentioned above for Flight Reservation application can be written as follows using Dynamic method:

Set desc=description.Create()
desc(”text”).value=”Login”
desc(”Class Name”).value=”Dialog”

Set agent=description.Create()
agent(”nativeclass”).value=”Edit”
agent(”attachedtext”).value=”Agent Name:”

Set password=description.Create()
password(”nativeclass”).value=”Edit”
password(”attachedtext”).value=”Password:”

Set button=description.Create()
button(”nativeclass”).value=”Button”
button(”text”).value=”OK”

Dialog(desc).WinEdit(agent). Set “fgfdgfdgf”
Dialog(desc).WinEdit(password).SetSecure “48a1881a08961df276749334f4511d5a7d35e922″
Dialog(desc).WinButton(button).Click
Window(”title:=Flight Reservation”).Close


AddThis Social Bookmark Button





Home   |   About Us  |   QA Library   |   Learning Center   |   FAQs   |   Career Center  |   Link Exchange   |   Contact Us
Copyright © QACampus.com. All Rights Reserved.
Powered By : codeplatter
Vision / Mission CresTech Connection Management Team
QACampus Courses ClassRoom Training Live Projects E-courses
Blog Forum QA Library
Career Center Hot Job Upload Resume