http://quicktesthp.blogspot.com

QTP VBScript new series + Interview Question Bank on QTP for enrichment of Knowledge in QTP

This Site has been brought to you by HP Certified Expert of QTP.

Exciting new articles for October:

1) QTP Tip:Deselect all Radio Buttons

2) HP QTP Crypt Object

3)Adding Hyperlinks in Excel Spreadsheet

Best of Luck Friends ! ! !

Expert QTP
expert.qtp@gmail.com

All Articles are Copyright Protected. These are Free for Reading & Personal Use. Reproduction in Any Form without the Permission is Illegal & Strictly Prohibited.

Copyright © 2009 ExpertQTP

Google Search

Wednesday, January 7, 2009

Discovery of a Peculiar Bug in QTP Analog Recording

I take an opportunity of sharing my discovery of a new Bug in QTP with my esteemed readers. I discovered it while doing an Analog recording.

Prior to the explanation of the bug let us see the overview of the Analog Recording process according to the QTP 9.2 help file.

According to the "Guidelines for Analog and Low Level Recording" section in the QTP 9.2 help file, you will find that there are two types of Analog Recording modes:

1. Record relative to the screen
2. Record relative to a specified window

Record relative to the screen option is used when you intend to perform operations on objects in either a moving window or if you have objects across multiple windows. Also, the HP Quicktest Professional (QTP) Software captures only the Active Screen image of the final state of the window, which you just recorded.

Record relative to a specified window is used when you intend to perform operations on objects which are present in a single window only. Also HP QuickTest Professional does not capture any Active Screen images in this case.

Now coming back to the bug which happens to be the most funny part as well. The event happens to occur the other way round in case of capturing the Active screen images. What actually happens is that QTP is capturing the Active Screen image in case of "Record relative to a specified window" option as against for "Record relative to the screen" option.

The illustration of the bug goes like this: Let us go by a very simple example being presented herewith.

Open the Command prompt by navigating to Start->Run. Type "cmd" and press the return key.

After opening the command prompt, please follow the below mentioned steps to reproduce this error.

Step – 1: Click on the record button inside QTP and then Click on the "OK" button on "Record and Run Settings" dialog box.

Step – 2: After executing Step1, Analog recording button must be activated in the Automation toolbar. Click on the Analog Recording button. You will see the following screen:

Photobucket

Step – 3: Keep the default option "Record relative to the screen" option selected and click on the "Start Analog Record" button.

Step – 4: Move your mouse inside the command prompt window and click anywhere inside it to make this window active and type any text for example "xyz".

Step – 5: Stop the recording by clicking on the "Stop" button inside QTP.

Step – 6: Click on View->Active Screen.

Now as per the HP Quicktest Professional Help file, the active screen should be displayed. Whereas the Output what I got is shown in the following screen shot with nothing in the Active Screen.

Photobucket

Pretty interesting, I must say.

Now lets try the above mentioned steps for "Record relative to the following window" option.

Execute all the above Six steps as it is, however, execute the Step - 3 in the following manner:

#####################################

Alternative way of Step – 3:

"Check the "Record relative to the following window" radio button and click on the hand icon on the right. Your cursor will change to a hand.

Now move this hand to the title bar of the command prompt and click on it.

With this step, QTP captures the command prompt title as shown in the following screenshot.

Photobucket

Click on the "Start Analog Record" button.
#####################################

After executing the above-mentioned steps, I got the following result as shown in the following screenshot.

Photobucket

This is the expanded view of the above screenshot:

Photobucket

Photobucket


Bug confirmed, Hence proved :)

How about reporting this bug to the HP customer support? Whose gonna take the initiative?

Being Technology Savvy, I am sure you must be curious to read many more interesting articles on QTP; How about subscribing to my Feed? This will help you in automatically knowing the moment I post an article on my Site.

So let us join and let us Learn & Master the great Tool QTP.

Tags: HP QTP, Quicktest Professional, QTP Blog, QTP Bug, Bug inside QTP




Read more...


Sunday, January 4, 2009

Lock your PC automatically after the execution of QTP Scripts

The beauty of Automation Testing is that Scripts are run in an unattended mode.Thus, what people usually do is, prepare the batch of scripts and leave for their homes. After the batch gets over, no matter even if it passes or even get failed, the PC is unlocked inviting others to view your secret project related data.

This remains a small issue in a simple project based company. However it can become extremely devastating issue in case of a company having Finance or Banking related projects, having top most concern for the security of its data.

So one wonders as to what can be the way by which this situation can be tackled?

I had been scratching my head to device a way to lock my PC automatically after my scripts get executed?

Ultimately I cracked the hard nut by a simple way. Now lets see how..

You can use the following QTP Script to lock your PC :

Set obj = CreateObject("WScript.Shell")
sCmnd = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation"
obj.Run sCmnd, 0, False

The above QTP script will lock your PC automatically. Moreover, I will suggest you to create this script as a separate script and call this script lastly in your batch. This will solve the purpose.

Being Technology Savvy, I am sure you must be curious to read many more interesting articles on QTP; How about subscribing to my Feed? This will help you in automatically knowing the moment I post an article on my Site.

So let us join and let us Learn & Master the great Tool QTP.

Tags: HP QTP, Quicktest Professional, lock PC using QTP




Read more...


 
Copyright © 2009 ExpertQTP