Posts

how to access the excel file as database in UFT?

We mostly use the excel file in UFT by using the excel object but it can also be accessed as a database and you can run the queries on different excel sheets as the database tables. You can use the ADODB connection to use the excel as database. Below is the code snippet to use excel as a database. Set  Conn =  CreateObject ( "ADODB.Connection" ) Set  RecSet=  CreateObject ( "ADODB.RecordSet" ) Conn.Open  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="  & ExcelFilePath&  ";Extended Properties=""Excel 8.0;HDR=YES;IMEX=1"";" If you want to access the .xlsx file then please change "Excel 8.0" to "Excel 12.0". After making the successful connection, you need to provide the query and execute it using the recordset in the same way you do it for database tables. But here you need to provide the excel sheet name as database tables.  Query =  "Select * From ["  & sheetName &  ...

How to ignore browsers apart from application under test at the time of recording and execution

Image
HP UFT has an option where it can ignore the browsers which are opened on the machine apart from the application under test. User needs to go to Tools -> Options - > GUI Testing Under Web in General, you need to specify the browsers with properties title and URL. This option by default ignores the ALM browser. Using the above options user can define the browser which always get opened on his machine while recording but these shouldn't be used while recording or running the test on application under test.

UFT - Recording test on different browsers installed on machine

Image
As the things are changing very rapidly in test automation space, HP is also changing the things in UFT. While recording any application using UFT previously you can do it only using the Internet explorer but as many different browsers have come up and applications also behaves different on some browsers. UFT has given as option where you can choose the browser on which you want to record or run the application. When you select the radio button "open the following address when a record or run session begins" there is a dropdown which gives the list of browsers installed on the machine. And you can select any one of them.

Time Slots reservation in HP ALM

Image
In this post I will be showing how to setup the time slot for the testing hosts, so that testers will not face any unavailability of testing hosts at the time they require to run there automated test scripts. After navigating to TimeSlots tab in ALM, user needs to add a new time slot for his tests as shown in below image: After clicking the new timeslot a new window will come where you need to fill all the required details. 1. Run - You need to select which type of test you want to run "Functional Test Set", "Performance Test" or "Build Verification Suite" 2. Start: User need to select whether he wants the execution to start manually or automatically in this timeslot. 3. Name: User need to provide the name of the timeslot 4. Select a test set: User need to browse through the test sets and select the test set which he wants to execute if any. 5. Duration , Start Time and End Time: User needs to provide the duration of the time slot and...

How to calculate the execution time for few steps without scripting in UFT?

Image
Sometimes we want to find out time consumed by certain number of steps while executing in test automation scripts and we end up either by adding up time for each step or scripting using the date and time feature. But QTP/UFT has provided a functionality called as "Transaction" which can be used to calculate the time spent between those steps. We need to start the transaction before the first step and need to end the transaction after the last step of the set of steps which we want to analyse. Either you can write the below lines or you can insert using the QTP tool bar.  Services.StartTransaction  "<user defined name>"  Services.EndTransaction  "<Same name as given in start transaction>" Below image shows how the transaction details shows in the results.

Descriptive Programming or Object Repository in UFT

There is always a discussion about what to use between descriptive programming or objective repository to identify the objects with QTP/UFT. And nowadays testers are going more towards descriptive programming instead of having knowledge about its advantages and disadvantages. I am writing not against any methodology but putting my perspective about when to use descriptive or object repository. The first reason users always give with descriptive programming that it is used when object is dynamic. But don't we have regular expression functionality in object repository which can also handle the dynamic objects. And you can write any logic to find the property and same property can be set to the test object using SetTOProperty method. Also the setting of object identification in QTP resolves most of the issues with the object identification. The second reason users give is about the speed. This is also a misconception, as qtp works faster with object repository in comparison t...

VB script code to change the field of a test case in ALM

Below code helps in updating the data of any field of multiple tests uploaded in ALM without logging into the ALM. You just need to feed the name of the test cases , folder path and ALM credentials.  I have passed all the data from excel and created a macro in same excel using the below code.     Set td = CreateObject("TDApiOle80.TDConnection")     Dim rng As Range     RowCnt = Sheets("Sheet2").Range("A1").End(xlDown).Row     ALMUrl = Sheets("Sheet1").Range("B1").Value     ALMDomain = Sheets("Sheet1").Range("B2").Value     ALMProject = Sheets("Sheet1").Range("B3").Value     ALMUserId = Sheets("Sheet1").Range("B4").Value     ALMUserPwd = Sheets("Sheet1").Range("B5").Value      RowCnt = Sheets("Sheet2").Range("A1").End(xlDown).Row     '=========================================     Set tdc = CreateO...