Testing is now an essential phase of the software development life cycle to secure the product’s quality. Also, without having testing, we can’t ensure the fulfillment of all the requirements. Here automation is playing an essential role in the testing cycle to reduce the efforts and time. In the market, there are multiple testing tools available to automate the testing process. The most used automation testing tool is UFT.
In this UFT Tutorial, we are going to learn the below topics –
- Recording in UFT
- Checkpoints in UFT
- Dictionary Objects in UFT
- Test Execution in UFT
UFT Tutorial – Table of Content
UFT Tutorial #2: UFT Setup – Download, Install, License Configuration and ALM Connection
UFT Tutorial #3: UFT Object Repository
UFT Tutorial #4: UFT Actions & Function Library
UFT Tutorial #5: UFT Parameterization
UFT Tutorial #6: VB Scripting in UFT
UFT Tutorial #7: Step by Step Guide to Create Test Case in UFT
UFT Tutorial #8: Exception Handling in UFT
UFT Tutorial #9: Recording in UFT with Checkpoints & Dictionary Object
UFT Tutorial #10: UFT Interview Questions and Answers
UFT Tutorial #8: Recording, Checkpoints & Dictionary Object in UFT
Recording in UFT:
Automation recording in uft is an option to record the manual navigation in the test application through the UFT tool to generate the linear test scripts. All the data in the recoded scripts are hardcoded. The record and play approach is ideal for one-time execution. But for the longer run, we need to modify the recoded test cases to implement data parameters, reusables proper test framework, etc. Recording in UFT can be initiated by pressing the F6 key or Record button under the Record tab.
Limitations of recording in UFT:
· All the data are hardcoded.
· Recorded scripts are not stable and difficult to use for the longer run.
· Required high maintenance efforts.
· Redandant duplicate object hierarchy can be created.
Different options for recording in UFT:
· Normal mode/ UI Automation Recording – It’s also known as Contextual, which is the default recording behavior that uses the full features of the UFT object recognization approach. It’s used to record UFT compatible applications.
· Low-level recording mode – If the application is not compatible with UFT, i.e., the entire screen is identified as a single Win Object. In this case, the low-level recording mode can be used to record the steps based on the application co-ordinates.
· Analog Recording – It’s used to record mouse movements and keyboard operation.
· Insight Recording – Insight objects can be inserted on any AUT. Once we press the Record button, Insight Recording appears under the Record menu and recording toolbar.
Different recording options can be chosen by selecting the recording mode from the recording wizard.
Step by step Guide for Recording in UFT:
Recording Scenario: Search the keywords “Automation Testing” on google.
Step1# Open internet explorer and navigate to www.google.com.
Step2# Start the recording by pressing the “F6” button or selecting the menu “Recording-> Record F6”.
Step3# For the first time below “Record and Run Settings” wizard appears to configure the recording settings such as URL, Record, and run on any open browser, etc. Same configurations are also available for mobile or Windows Applications. Here, we will select the “Record and run on any open browser” option and proceed.
Step4# Now the recording wizard appears, and we can manually navigate the scenario in the web browser. UFT will capture the steps which are performed manually and store in the test case.
Step5# After completion of manual navigation, click on the stop button to end the recording. The recorded script will look like below.
Checkpoints in UFT:
Checkpoints in UFT are used to verify the specified properties of objects between actual values and expected values. These verification points are performed at the run time. If the expected values are matched with actual, UFT will generate PASS statue; else, it will be FAIL status. Checkpoints are used based on functional specifications.
Types of Checkpoints in UFT:
There are different types of checkpoints available in UFT. Those are –
· Standard checkpoints in UFT: It validates the expected values of the object, which are captured during recording with the actual values of the object during the execution time.
· Page Checkpoints in UFT: When a standard checkpoint is created for a web page is called a page checkpoint. Page checkpoints in UFT are used to validate the different types of object count, such as links, images, etc. Also, it can be used to check the time taken to load the web page.
· Bitmap Checkpoints in UFT: It is used to check the bitmap of an image or the entire webpage. It performs a pixel to pixel comparison of the test image.
· Image Checkpoints in UFT: It helps us to check properties like the source file of the image. We can not use it to check the bitmap or pixel of the images.
· Text Checkpoints in UFT: It checks the text available in a webpage or application. This text can be available in a small portion or section of the application.
· Accessibility Checkpoints in UFT: It verifies standards as per W3C instructions and guidelines for Web-based technology and information systems.
· Database Checkpoints in UFT: It’s used to verify the database. It creates a query to store database values as expected values during recording time. During the execution, the same query is used to capture current values from the database, which will be compared with expected values.
· Table Checkpoints in UFT: In Table Checkpoint, we can check the contents of the table during the run time. Initially, these checkpoints store the contents of a table as an expected value, which will be verified with the actual table value during execution.
· XML Checkpoints in UFT: It’s used to verify XML files.
Step by Step Guide to Create Checkpoints in UFT:
Now, we will learn how to create standard checkpoints in UFT based on the below example. By following the same guide, we can create different types of checkpoints.
Checkpoint Scenario: Create standard checkpoints in UFT during the recording in the web-browser.
Step1# Open internet explorer and navigate to www.google.com.
Step2# Start the recording by pressing the “F6” button or selecting the menu “Recording-> Record F6”.
Step3# Search the keywords “Automation Testing” on google to record the corresponding automated scripts.
Step4# Now select Standard checkpoint from the menu navigation “Design->Checkpoint->Standard Checkpoint F12” or pressing the “F12” key.
Step5# Select the desired object in the application for which a standard checkpoint needs to be created. Here, we are selecting the web element to verify the text “Test Automation Software.”
Step6# Review the Checkpoint properties and click OK to add the checkpoint step into the test case.
Step7# Checkpoint step is now added in the script. Also, the same is available in the object repository as well. In this scenario, the inner text property of the test object will be validated during the execution.
Step8# Checkpoint verification status can be seen in the UFT execution report.
Dictionary Object in UFT:
The dictionary object in UFT is similar to the array. But the primary difference with the array is that there is a key associated with each element in the dictionary object.
The dictionary object in UFT can be defined by referring to the Scripting.Dictionary class.
Advantages of Dictionary Object in UFT:
· It stores items in an organized way.
· Easy to access any items using the key string.
· It is more flexible to handle with pre-defined methods.
Example of Dictionary Object in UFT:
Create a Dictionary Object:
Dim dict’ Create a variable.
Set dict = CreateObject(“Scripting.Dictionary”)
dict.Add “Company”, “Microfocus” ‘Adding keys and items.
dict.Add “Tool”, “UFT”
dict.Add “Trainer”, “LambdaGeeks”
Checking the Existence of Specific Keys:
If dict.Exists(“Company”) Then
msg = “Key exists”
Else
msg = “key doesn’t exist”
End If
Read Any Item: dict.Item(“Company”)
Get The Count: dict.count
Delete Any Item: dict.Remove(“Company”)
Delete All Item: dict.RemoveAll
Test Execution in UFT:
Steps for Test Execution in UFT are shown below –
Step1# Open the test case in UFT.
Step2# Click on the Run button or press the “F5” key to initiate test execution in UFT.
Step3# Now, we need to select the Result Location. If there are any ALM test sets are available or need to execute from a specific folder, we need to select the first option, i.e., “New run result folder.” For any temporary run to check the script, we need to select the second option. Once the selection is done, please click on the Run button to start the execution.
Step4# After completion of the execution, we can view the default UFT result from the menu navigation “View->Last Run Result.”
Test Debugging options in UFT:
The different debugging options are mentioned below –
Debug Point: By pressing on the “F9” key, the debug point can be added to the selected line of code. It’s required to pause the execution pointer at this particular line. Using the same key, we can also remove the selected breakpoint.
Run From Step: By pressing on the “Ctrl+F5” keys, execution can be started from the selected step.
Step Over (F10): If we want to perform line-by-line debugging, we need to keep on clicking on the “F10” key.
Step Into (F11): If we want to perform line by line execution, including child components as well, we need to keep on pressing the key “F11”.
Clear All Breakpoints: We need to press on keys “Ctrl+Shify+F9”.
Conclusion:
In this “Advance UFT Features” article, we have learned about important advanced UFT concepts such as Recording, Checkpoint, Dictionary Object, Test Execution in UFT, etc. Click here to understand more from the Microfocus support
portal. Also, if you want to prepare for UFT Interview Questions, please click here.
Hi, I am K. Mondal, I am associated with a leading organization. I am having 12+ years of working experience across domains e.g., application development, automation testing, IT Consultant. I am very much interested in learning different technologies. I am here to fulfill my aspiration and currently contributing as an Author and Website Developer both in LambdaGeeks.
Lets Connect through LinkedIn-