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.
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 »
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 »
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…
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 »
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 »
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 !
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 »
-
Archives
- June 2009 (1)
- April 2009 (1)
- March 2009 (1)
- August 2008 (5)
- July 2008 (4)
- May 2008 (2)
- April 2008 (3)
- February 2008 (3)
-
Categories
-
RSS
Entries RSS
Comments RSS