haripotter’s technorati

Just another WordPress.com weblog

How to determine if a test is executed from Quality center test lab

Hmmm. I’m back after a long time.  Okay.. lets get started.. How do we know if the test is being executed from a testset in testlab module of HP Quality center ?.. During development of the test script, we have to execute the code to see if the testscript is performing the test the way we wanted it to. We execute them directly from QTP IDE, even though we have connected to QC from QTP IDE. Let’s say one of your function does something that is dependent on the testscript name. Usually we use qcutil.CurrentTest.Name to determine the testscript name. But if we are not connected to QC, then this call will fail. In that situation, if we want to know if the test is executed from QC or from local system, we can use this function. Here’s the function. Enjoy.. In another post, I’ll provide the code for determining the testscript name irespective of whether QTP is connected to QC or not.

Read more »

April 2, 2009 Posted by haripotter | HP Quality Center and QTP | | No Comments Yet

How do we send email from QTP ?

We can send an email from a QTP testscript by using the below function. It uses CDO.Message object to perform that action. We use the SMTP Server to deliver the email message to the concerned email ID. Please update the values as per your environment. This function sends a email attachment to specified email address.
Read more »

August 8, 2008 Posted by haripotter | General, HP Quality Center and QTP | , , , | 3 Comments

How do we use QC as Shared repository… ?

There was comment posted in this blog asking if we could use QC as a shared repository to store file and update it directly, without downloading to local desktop. I’m afraid that it is not possible to do without downloading the file to local desktop. But We certainly can use QC as a shared repository to store files and have it accessible to many tests. There are cases when multiple QTP tests may have a need to access the same file which is stored in the test’s project repository in QC. When we attach the file to a test, other tests will have to access this attachment through this test. Alternatively, a copy of the same file could be attached to each and every test. That would be a maintenance nightmare. So what would be the solution ? Read on…
Read more »

August 3, 2008 Posted by haripotter | HP Quality Center and QTP | , , , | No Comments Yet

How to disconnect a network drive using vbscript

Below is a script to disconnect a network drive using vbscript. We employ the services of WScript.Network object to do the same :) Enjoy!. There are two functions below. One is the actual disconnect drive and the other one is to parse the command line arguments. We want to make sure the drive letter that has to be disconnected, is specified as an input parameter to the script.
Read more »

August 2, 2008 Posted by haripotter | HP Quality Center and QTP | , , , , , | No Comments Yet

Executing a command on a remote windows system using WMI

Usually we use psexec tool from sysinternals to execute any program on a remote system. There is another way to execute a command on a remote windows system via WMI (Windows Management Instrumentation). This function would be beneficial to QTP automators because its a vbscript function and can be used in their function libraries (after some modifications). All you have to do is call this function with the target system name, username, password and the command to execute. The output would be the process if of the process that was initated on the target system. Have fun…

  Read more »

July 25, 2008 Posted by haripotter | HP Quality Center and QTP | , , , | 3 Comments

Download all the attachments from a specific folder in QC

There was a recent request from Salman asking how to download the folder contents from QC. I’m assuming he meant to download all the attachments from a specific folder in QC. I tweaked my earlier function  to download all the files instead of specific file. Here is the function.. Enjoy.
Read more »

July 18, 2008 Posted by haripotter | HP Quality Center and QTP | , , | 2 Comments

Vbscript to revert a ESX Virtual machine snapshot

First of all, let me clarify that the snapshot restore is completely done by the VMWARE perl toolkit. But there may be instances where you cannot remember this long command to revert a virtual machine snapshot. You could create a vbscript function that will help you out with a much easier syntax . All you’ll need is the esx host name where the virtual machine is registered to, the login credentials to the esx host and the virtual machine name. Another advantage is you could use this from QTP to automate the vm snapshot restore process.
Read more »

July 16, 2008 Posted by haripotter | HP Quality Center and QTP, Virtualization | , , , , | No Comments Yet

Determine the mapped drives on QTP Client

You can use WMI Class Win32_LogicalDisk to find that out. With this class not only can we determine which drives are mapped to network shares, but we can also determine which network shares they map to. Please note that the DriveType equal to 4 represents a mapped network drive. For more details about Drivetype values, refer the WMI SDK. The WMI query returns a collection of mapped drives. DeviceID, which returns the drive letter for the drive; and ProviderName, which returns the network share the drive is mapped to .
Read more »

July 2, 2008 Posted by haripotter | HP Quality Center and QTP | , , , | No Comments Yet

Determine the current time on a remote system

At times you may have to determine the time on a remote system to be able to schedule some job on that system automatically. I will talk about how to schedule a job on a remote system in a seperate post. We could use the help of WMI protocol in determining the target system time.
Here’s the function. Have fun !

Read more »

May 22, 2008 Posted by haripotter | HP Quality Center and QTP | , , , | 3 Comments

Javascript FireEvent on a WebEdit

There are certain webpages that contain WebButtons that will get enabled only when you complete the text fields (WebEdit). Using QTP, you’ll probably use the set function, for ex WebEdit.Set “Hello” to set the value in a text field. But You’ll observe that the WebButton is still not enabled. Hmmm.. What could be wrong ? If the WebButton is programmed in such a way that it will get enabled only when there is a Javascript event “onkeyup” is fired, then using the set function will not help, because it will not fire this event after entering the text. Read more »

April 30, 2008 Posted by haripotter | HP Quality Center and QTP | , , , | 2 Comments