27 November 2014

Selenium Keyword Driven Test Automation Framework

Onscreen Display of Execution Progress for Selenium using AutoIT

The post describes a method of displaying the execution progress on screen for Selenium. All you need is an AutoIT script that you can convert to a ".exe" tooltip utility file and change a registry value which is read by the utility file. The below info-graphic displays the control flow.

The key to this design is the creation of a registry key on the system which is continuously read by the tooltip file and the value is displayed at the top right of the screen. Hence, as the registry key value is changed, the code in the tooltip utility refreshes the onscreen display with the new value. The utility needs to be launched only once at the start of the test execution. You can set this in the driver of your framework. Also, you need not kill the process every-time you start your test execution as you can set the registry value as 'EXIT' such that the utility exits itself. 

Here is a small video that displays the idea in action.

The code below shows the code for creation of the registry key depending upon whether it exists or not and displays appropriate messages on the console.

public void main() throws Exception {
/*check environment registry for tooltip*/
System.out.println("====>>>>>>regkeyexist>>>>>>"+Advapi32Util.registryKeyExists(HKEY_CURRENT_USER, "Environment\\selenium"));
  if (!Advapi32Util.registryKeyExists(HKEY_CURRENT_USER, "Environment\\selenium")) {
   Advapi32Util.registryCreateKey(HKEY_CURRENT_USER, "Environment\\", "selenium");
                 Advapi32Util.registrySetStringValue(HKEY_CURRENT_USER, "Environment\\selenium", "envvariable", "tooltip_exists");
   System.out.println("====>>>>>>regkeyexistcreated?>>>>>>"+Advapi32Util.registryKeyExists(HKEY_CURRENT_USER, "Environment\\selenium"));
   if (!Advapi32Util.registryGetStringValue(HKEY_CURRENT_USER, "Environment\\selenium", "envvariable").contains("tooltip_exists")) {
    System.out.println("====>>>>>>regkeykeyvaluenot initiated>>>>>>");
   } else 
                        {                               System.out.println("====>>>>>>regkeycurrentvalueinitiated>>>>>>"+Advapi32Util.registryGetStringValue(HKEY_CURRENT_USER,"Environment\\selenium", "envvariable"));
  } else {
   System.out.println("====>>>>>>regkeyexistchecktrue>>>>>>"+Advapi32Util.registryKeyExists(HKEY_CURRENT_USER, "Environment\\selenium"));
   System.out.println("====>>>>>>regkeycurrentvalue>>>>>>"+Advapi32Util.registryGetStringValue(HKEY_CURRENT_USER, "Environment\\selenium", "envvariable"));

You need to import the Advapi32util class -

import com.sun.jna.platform.win32.Advapi32Util;

You can create a function as shown below and call it with the string that you want to display on the screen at run time -

public void settooltip(String var) {

  Advapi32Util.registrySetStringValue(HKEY_CURRENT_USER, "Environment\\selenium", "envvariable", var);


The AutoIT script for the utility is written below. You just need to use the AutoIT suite to create the script and convert it into an exe and call it in your code.

$Env = RegRead("HKEY_CURRENT_USER\Environment\selenium", "envvariable")
$TEMP = $Env
ToolTip($Env, 0, 0)

While 1
 $Env = RegRead("HKEY_CURRENT_USER\Environment\selenium", "envvariable")

 If $Env<>$TEMP Then
  ToolTip("............", 0, 0)
  Sleep (1000)
  $TEMP = $Env
  ToolTip($Env, 0, 0)
  If $Env=="EXIT" Then

12 October 2013

How to detect and pause QTP test execution on a Virtual Machine (VM) if remote disconnects?

If you are running an execution for longer periods over a Virtual Machine (VM) using QTP, you might need to handle the remote disconnections if any, which would otherwise result in test-case failures. Here is a simple code that pauses the execution if you disconnect the remote. This code would keep the execution paused unless you resume it again after taking the remote of the VM. 

1. Commandline Utility 'qwinsta.exe' - this is a small utility that queries and resets remote session.

By default, you will find this utility on Windows 2000+ which includes Windows 2003, Windows XP, Win 7 and Win 8. As an example on a Win 8 machine, the location of this file is the following:


If you fire the command 'qwinsta' from a non-remote console, this is the output that you get:

If you fire the command 'qwinsta' from a remote console, this is the output that you get:

Now, by noting down the difference in the outputs of the 'qwinsta' command when a machine is in remote and disconnected states respectively, we can write a small Vb-script code which is executed by QTP at the start of each test-case or step as per your wish, the execution can be paused. Also, remember that the output might change as per the OS installed. The screenshots above are from a Windows 8 machine.

23 November 2012

Dojo Automation with QuickTest Professional 11 - Incompatibility, Workarounds and Framework

Dojo happens to be one of the trickiest of technologies that is supported by QTP 11. Dojo is an open source Javascript Toolkit/Framework which allows faster development in the simplest of ways. Now QTP does provide support for Dojo in essence but it is not that simple. Since, Dojo is an open source technology, it is adopted by various organizations and customized as per their requirement. For example, if QTP 11 recognizes a Dojo Tree in one application developed by Company A, it might not in an application developed by Company B. Now to get around the problem, you can use the Extensibility Accelerator (EA) with QTP 11. 

Dojo Toolkit Versions QTP Support
================== ==========
Dojo 1.7.3 Not Officially Known
Dojo 1.6.1 Not Officially Known
Dojo 1.5.2 Officially Not Supported
Dojo 1.4.4 Not Officially Known
Dojo 1.3.3 Not Officially Known
Dojo 1.2.4 Not Officially Known
Dojo 1.2.3 Officially Supported - Yes
Dojo 1.1.2 Not Officially Known
Dojo 1.0.3 Not Officially Known
Dojo 0.4.4 Not Officially Known

Using the Extensibility Accelerator (EA)

Now Extensibility Accelerator (EA) is nothing but a set of (JavaScript) JS files that you will typically find in the folder where QTP is installed. These JS files hold the key as to how QTP recognizes the various controls in your application. If your organization uses customized dojo controls or a dojo toolkit version not officially supported by QTP, you will need to play around with these JS files or use the logic in these files and convert them into VBScript to get QTP 11 to work with the dojo controls. You can directly use the EA to create new addins as well but I liked the idea of converting the logic to VBScript and implementing the same as that provided more flexibility in my perception. So technically, you end up creating a framework sort of structure in VBScript where you create functions to handle each of the dojo controls. 

Factors that affect the use of  Extensibility Accelerator (EA) or the creation of a similar framework in VBScript:

1. Your application needs to be extremely stable which means if the developer later customizes the control you might end up changing a lot of code.
2. An IE version change from version 7 to 8 to 9 or 10 may require a lot of rework.
3. A corresponding Dojo Toolkit version for the AUT change may require a lot of rework.
4. You need proper collaboration with the developer when you automate a dojo application.
5. At times in a worst case scenario, you might need to use QTP functions like Highlight in combination with DeviceReplay functions.  

Creating the Dojo VBScript framework in QTP

For example, I will use the Dojo Tree control. To find the Dojo Tree JS File, simply browse to the following location - C:\Program Files (x86)\HP\QuickTest Professional\dat\Extensibility\Web\Toolkits\Dojo\\JavaScript\DojoTree.js

08 May 2011

Automating Nokia Symbian OS using QTP: Basic Application Testing

Over the weekend as I was getting bored, I thought of giving this idea of automating the Symbian^3 OS of my Nokia N8 a shot. The test script is not bad if you are actually looking to navigate through an application within the OS. This test script is based out on an application called Remote Professional. This application present the exact interface of the connected phone on your computer screen. This application also provides a few other functionalities like, triggering some of the hardware buttons on the phone.

Technically, the script tries to unlock the phone and sends a SMS from the phone. The possibilities look great if you are a mobile developer working on a Symbian OS and looking to create a basic test suite for your application. Remote Professional runs on Symbian^3, S60 5th & 3rd Edition, Series 60 v1/v2 or UIQ 3 phones and is compatible with Windows 2000, XP, Vista and Windows 7.

23 April 2011

Dumps For HP AIS Certification (QuickTest Professional v10 and Quality Center v10) - HP0-M39 and HP0-M31

After a lot of searches on the internet, I finally succeeded in getting the latest dumps for the HP AIS Certification which you attain after completing HP0-M39 (QTP 10.0) and HP0-M31(QC 10.0) exams. The earlier version of HP AIS (with QTP 9.5 and QC 9.2) is no longer valid and you are required to upgrade to the new certification. This is a pre-requisite for the HP ASE certification. You do not get a free pass to the HP ASE certification with the older AIS certification and you are required to attain the newer AIS certification.

HP0-M39 Certification Questions

HP0-M31 Certification Questions