Posts

Showing posts from 2016

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.

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...

VB Script code to upload multiple test in ALM without any Manual intervention

Below code can be used within excel also as a Macro and the details required for the ALM connection and list of tests with the ALM folder where tests needs to be updated. 'Gets the count of the QTP tests needs to be uploaded in ALM RowCnt = Sheets("Sheet2").Range("A1").End(xlDown).Row 'Credentials required to connect QTP with ALM 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 'Below steps makes QTP connection with ALM using the above credentials Set objQTP = CreateObject("QuickTest.Application")     If Not objQTP.TDConnection.IsConnected Then         objQTP.TDConnection.Connect ALMUrl, ALMDomain, ALMProject, ALMUserId,                           AL...

What is the difference between Call to copy of Action and Call to existing action in QTP/UFT?

There are 2 ways in UFT/QTP where you can call the external actions in a new test. The first option is Call to copy of action, in this option the copy of the action will be copied over to the test and there will be no reference to the original action. All the resources of the action like repository or data table will also be copied. And if you do any changes in the action it will not be reflected in the other test. The second option is Call to existing action, in this option QTP just creates a call to the action but the resources will not be copied over. And user will not be able to edit the action in the new test. If you edit the action in the original test then those changes will be reflected in the tests wherever the action is called. There were some scenario's i have seen where testers have used the call to existing action but when the original test with action is shifted to some other location, they haven't changed the location in the test where the action is calle...

How to correct the action flow in Script when the actions are executed based on driver script?

Image
As we tend to run the actions in UFT/QTP by our driver script based on the flag set in the excel sheet or any input file, we don't want the flow in the solution to interrupt the execution. As the new concept of solution comes in the UFT, whenever you add any new action it gets added in the flow of the solution sequentially. For e.g. you have an existing action "Action1" and then you create a new Action with name "Action2". So in the flow the Action2 will be added after Action1 and as soon as the execution of Action1 completes Action2 will get executed. But we want the execution of actions should be derived from the driver script, So we need to remove the Action2 from the solution flow. If you try to do it directly from the solution then there is only one option "Delete Action". The workaround to remove this call is, you have to first call the Action2 from some other Action also and then delete the actions call from the solution flow as sh...

UFT componenets which are required for BPT in ALM

Image
Continuing from my last post on Business Process Testing in HP ALM. In this post i will share the artifacts which will be created in UFT and getting used in creation of test cases in BPT framework. One thing always should be considered while creating these artifacts for BPT is that the UFT should be conected to ALM which has BPT license, else you will not be able to create them. The first artifact which is required is Application Area. In application area we attach all the resources like functional libraries, vbs files, object repository etc and it will be saved in ALM to the domain and project you have logged into. It will be saved in the resources tab in ALM. This application area can be used by any business component which will help us to manage the resources for different components. After creating the Application Area, the second artifact will be the business component which will have all the test steps you want to perform on the application. But as per my last f...

Business Process Testing part 2

Image
Continuing from where i left on Business Process Testing in my last post. I have given a brief introduction to BPT on HP ALM in my last post.  In this post, We will look into some benefits of BPT and how does BPT works. The images in the post are the courtesy of the document provided by HP when they have introduced. I found this image as the self explanatory instead of creating anything new to confuse the users.       The operations performed by any particular keyword tended to be very fine-grained or atomic. Designing a test for an entire business process required the use of hundreds of individual keywords — a time-consuming process.       Since test framework solutions consist of files with keywords and their associated data elements, subject matter experts found that they were still creating scripts, despite promises by some vendors of “script less” test design.       Traditional test framework...

Business Process Testing in HP ALM

HP has introduced the business process testing framework in the ALM around 2006. This framework has been introduced by keeping business analysts in mind, so that they can create the scenario as per the logical flow of the application by themselves and instead of dependent on any automation tester to create a full test case for them and then they verify the whole test script functionality. In this framework the automation testers create the business components with the logical business names. Then business analyst or functional testers can create the test cases by arranging the business components in the sequence they want. This helps the business analysts to create the different scenario's on the go instead of raising the request and waiting for the automation tester to completed the coding for this test script. Here user can give different parameters for the same component in different test cases which was not possible when users use same test cases in different scenario...

How to check previous run results in Test Lab in HP ALM/QC

Image
It happens many times that we want to refer to the previous run results of the test in a test set but we don't know how to go to those results. The only thing you need to do is click on the name of the test in the test set in test lab and it will open a new window called as Test instance details. This window has all the details of the test such as planned execution date, status etc. This window has different tabs one of them is Runs. The runs tab shows all the previous run details such as status, exec date, time etc. You can open the result report of any execution by just clicking that row in the table and click on the Launch Report button. You can also drill down the details of each run by clicking the run id of the run which will open a new window called as Run Details. Below are the screenshots of both the detail windows.

Change in UFT settings to run scripts through ALM

Image
As we start our work to start the execution of UFT/QTP scripts through ALM, we change our scripts related to all aspects of repository linkage to script, functional libraries, input excels, uploading results files created after execution. But still when we try to start the execution from ALM the UFT/QTP is not able to open on the host and the execution is not able to take place. The basic setting which needs to be completed on the UFT/QTP for the hosts where you need to run the scripts. The user needs to open the UFT/QTP on the machine and need to go to Tools > Options and check whether the checkbox "Allow other HP products to run tests and components is checked or not. Nowadays, HP has provided this as one of the errors when you try to execute the script from ALM and if this setting is not done on the host. Its a very small step but takes alot of time to debug if you don't know the description of this option.

Type of Test sets in Test Lab in HP ALM

                              Type of Test sets in HP ALM I haven't explained the type of test sets while i have written the blog on adding testing hosts in HP ALM. And this has created a little confusion for one of the viewer. So i thought let me clarify the type of test sets here which will help you on type of testing hosts for those test sets. In HP ALM, it gives you 3 options whenever you go for creation of test sets i.e. Functional, default and Performance. As name suggests performance test automation scripts gets added to the performance test sets. And UFT/QTP scripts gets added to functional and default test sets. Below are the only differences between functional and default test sets: 1. Only functional test sets can be added to the build verification suite which users are nowadays use for continuous delivery. 2. The testing hosts used in the functional test sets are to be used from the h...

UFT - Resolving scrolling issue if object is not visible

There are many times when an object gets the place changed based on the list getting longer on the same webpage, which creates the need to scroll down on the webpage for any automation script to perform any action on the object. Many times we try to resolve this issue using the below code. Set objShell=CreateObject("WScript.Shell") objShell.SendKeys "{PGDN}" But if the place is dynamic and the lists above that object gets bigger then it requires more page down which will be never ending story and requires maintenance every time. So to resolve this issue we can use the below code which will take the pointer focus to the object. Browser("<object properties>").Page("<object properties>").Webbutton("name:=Next").Object.Focus After this you can perform any action on the object.