Posts

An easy way to create Database connection string in UFT

Image
I was also facing a lot of issues while creating the database connection string and remembering all the parameters. And always thought if there is any utility which i can use to create the connection string easily and can test it also without running my code. In UFT we have the microsoft query wizard where we can create the new connection string using the wizard and can save it in a dsn file. Below are the steps: 1. Open the Microsoft query wizard in UFT. Below screenshot will give you the easiest way to open it from UFT: 2. After clicking on "From Database" as shown in above screenshot. Select option "Specify SQL statement Manually" and click on Next. 3. Now click on Create button shown in below screenshot: 4. Now it will take you to create or select Data source. As we are creating a new, so you need to click on New button as shown in below screenshot: 5. After performing above step, select the driver based on the database you want to ...

How to read text file using UFT

We access the text file in UFT by using the filesystemobject. The UFT will read all the data line by line. Below is the sample code which can be used to read any text file. Set  FileSysObj= CreateObject ( "Scripting.FileSystemObject" ) Const  ForReading =  1 Set  txtFile = FileSysObj.OpenTextFile( "<textfile> " , ForReading,  True ) Do  Until  inputFile.AtEndOfStream    msgbox  inputFile.ReadLine   msgbox  inputFile.Line Loop inputFile.close You can use any conditional statement in the code which can be used to extract the required data from the text file.

How to access Excel as a database using UFT

Whenever we access excel through UFT, we always use the createobject method which blocks the excel and starts excel.exe process. It can result in problems if the test script stops abruptly. To resolve this issue you can access the excel as a database through UFT. Below code will help you with that.         Dim oConn, oRS, arrData, x,iStart         CONST adOpenStatic = 3         CONST adLockOptimistic = 3         CONST adCmdText = "&H0001"         Set oConn = CreateObject("ADODB.Connection")         Set objRecSet= CreateObject("ADODB.RecordSet")          'Open Connection         oConn.Open "Provid...

How to Create recovery scenario in UFT

Image
The first step in creation of recovery scenario is to open Recovery Scenario Manager in QTP using path Resources - > Recovery Scenario Manager After opening the Recovery Scenario Manager, click on New Scenario button to create a new recovery scenario. After clicking on New Scenario button in above step a setup wizard will open which will guide you through all the steps of recovery scenario. The first screen will be the recovery scenario wizard welcome screen as shown in below screenshot. Click on Next button in welcome screen. After clicking the Next button on welcome screen, Select the Trigger Event which will start the recovery operation. You need to select one of the options by selecting the radio button and click on Next. After selecting the Trigger event, the next window will be for specification depending on the option you have selected for trigger event. For e.g. if Pop-up Window is selected then you need to specify the window title whi...

What is candidate list in Smart Identification?

I also faced this question in one of interviews and didn't know what is candidate list even after working for more than 6 years in QTP. maybe be because most of the times we just find out how the tools is working and what are the functionalities we can use instead of looking into that particular functionalities process which you get to know only after reading the documentation. In smart identification we configure the base filter properties and optional filter properties for an object class, based on the base filter properties QTP creates a list of objects which has same base filter property value as of Test object. This list is called candidate list.  After list creation using base filter properties, QTP removes the object one by one from the list based on the each optional filter property values which are not matching with the test object saved in object repository. Then the last object which remains in the  list will be used by QTP to perform the required action. ...

How to unzip the file using QTP/UFT

There are instances where we download the zip files in the automation scripts and the documents in this zip file needs to be verified. So need to unzip the file through QTP/UFT so that without any manual intervention your automation script can complete the test case execution. Set  ObjShell =  CreateObject ( "Shell.Application" ) 'Get the contents of the ZIP archive Set  ObjZippedFiles=ObjShell.NameSpace(<path of the zipped file with file name>).items 'Copy the contents into the destination folder ObjShell.NameSpace(<Path to extract the File>).CopyHere(ObjZippedFiles) Set  ObjZippedFiles =  Nothing Set  ObjShell =  Nothing

Changing the Test Set type in ALM

Image
We always get stuck when we create a test set with default type and if we want to change it to functional or vice versa. Because the type field of the Test Set in HP ALM is disabled to be updated to some other type. But there is a button on the tool bar in the Test Lab module which switches the type pf the test set. You just need to select the test set for which you want to change the type and click on the button and then click on OK button for the confirmations generated by the application. This will remove the creation of new test set if you created the previous one with wrong type.