Posts

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.

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.