UFT Tutorial: Recording With Checkpoints & Dictionary Object

Recording in UFT Types

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 #1: UFT Overview

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.

Recording in UFT - Types
Recording in UFT – Types

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

Recording in UFT - Step2
Recording in UFT – Step2

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.

Recording in UFT - Step3
Recording in UFT – Step3

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.

Recording in UFT - Step5
Recording in UFT – Step5

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.

Checkpoints in UFT - Step4
Checkpoints in UFT – Step4

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

Checkpoints in UFT - Step5
Checkpoints in UFT – Step5

Step6# Review the Checkpoint properties and click OK to add the checkpoint step into the test case.

Checkpoints in UFT - Step6
Checkpoints in UFT – Step6

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.

Checkpoints in UFT Step7
Checkpoints in UFT – Step7

Step8# Checkpoint verification status can be seen in the UFT execution report.

Checkpoints in UFT - Step8
Checkpoints in UFT – Step8

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.

Test Execution in UFT - Run Setting
Test Execution in UFT – Run Setting

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.

Exception Handling in UFT & Synchronization (HandOn Guide!)

Recovery Scenario in UFT Step2 1024x474 1

In this Exception Handling in UFT and Synchronization article, we are going to learn the below topics –

· Exception Handling in UFT

· Recovery Scenario in UFT

· Synchronization in UFT

UFT Tutorial – Table of Content

Exception Handling And Synchronization in UFT

Exceptions in UFT:

An exception is nothing but an undefined event or error. In automation testing, if any errors or events are encountered which are not handled through the automated steps, they are treated as exceptions. Exceptions can be occurred due to any of the below scenarios – 

Bug – 

Any new bugs or issues in the application which are not handled properly can be the reason for an exception.

Environment Error – 

Environment outage or network latency can create exceptions as the expected screens/pages are not available.

Test data – 

Due to the correctness or invalid test data, an exception can occur during the test execution.

Technical issue – 

If the test case is not designed properly, an exception can occur during the test run.

Undefined popup – 

Any undefined popups such as Security, timeout, Information, Warning also can be the sources of exception.

The impacts of exceptions are – 

  • Test execution failure.
  • Need more effort to perform debugging/ re-execution.
  • Increase the cost and maintenance efforts.
  • Automation goal, i.e., ROI, can not be achieved.

Exception Handling in UFT: 

It is not possible to handle all the unexpected errors through automation. But if we use exception handling during the scripting, the chances of unexpected error can be minimized. The tool provides some mechanism for exception handling in UFT. The approaches for exception handling in UFT are – 

  • Recovery Scenario in UFT
  • Scripting and Test Setting
  • On-Error-Resume-Next statements for VBS
  • Using Test Settings
  • Using Exit Statement

Recovery Scenario in UFT:

A recovery scenario in UFT is an approach to handle unexpected events/ errors during the execution. The “Recovery Scenario Manager” wizard helps to manage the recovery scenarios. We can open the “Recovery Scenario Manager” by using the navigation “Resources → Recovery Scenario Manager.” While creating the recovery scenario, we need to perform three configuration steps in UFT based on the requirements. Those are Triggering Event, Recovery operations, and Post-Recovery Test Run Options.

Triggering Event: 

It defines the unexpected events, which will call the Recovery Scenario. The different options/ events available during the creation of recovery scenario in UFT are specified below – 

  • Unexpected pop-up windows.
  • Errors which may appear due to Object State.
  • Errors during the Run time.
  • Application Crash.

The main usage of recovery scenario to handle different types of unexpected errors and perform some predefined steps against each types of error.

Recovery operations: 

Based on this configuration, UFT will perform a set of actions for recovery purposes.

Post-Recovery Test Run Options: 

After the recovery, we need to configure these options to execute some predefined steps which may be required.

Step by Step guide to create a Recovery Scenario in UFT:

Now, we will learn how to create the recovery scenario in UFT based on an example.

Example – An error popup (missing mandatory fields) is appearing while trying to save the records intermittently. In this particular situation, we need to click on the OK button to close the error popup and re-execute the current step as a post-recovery action.

  • Step1#  We need to open the “Recovery Scenario Manager” from the navigation menu “Resources → Recovery Scenario Manager.”
  • Step2# Click on the “New Scenario” icon to open the wizard to create a recovery scenario in UFT and click on the Next button to select the triggering event.
Recovery Scenario in UFT - Step2
Recovery Scenario in UFT – Step2
  • Step3# We need to select the “popup window” radio option as the Trigger Event of the recovery scenario and click on the Next button.
Recovery Scenario in UFT - Step3
Recovery Scenario in UFT – Step3
  • Step4# Now, we need to click on the pointing hand icon and identify the error popup window using the mouse. UFT tries to identify the popup based on the window title and text. So, after the identification, we can use a regular expression to make it robust.
Recovery Scenario in UFT - Step4
Recovery Scenario in UFT – Step4
  • Step5# Initially, recovery operations are not set. To define the recovery operation, we need to click Next.
Recovery Scenario in UFT - Step5
Recovery Scenario in UFT – Step5
  • Step6# Now, based on our requirement, selecting “Keyboard or mouse operation.” On the next screen, select the “Click button with label” option using the pointer hand option and click on the Next button.
Recovery Scenario in UFT - Step6
Recovery Scenario in UFT – Step6
  • Step7# Recovery operation is defined now. Here, after unchecking the option “Add another recovery operation”, we need to click on “Next” button to proceed.
Recovery Scenario in UFT - Step7
Recovery Scenario in UFT – Step7
  • Step8#  We will select the option “Restart current test run” in the Post-Recovery section and provide the scenario name on the next screen. After entering the name, we need to click on “Next” button to proceed to the final screen.
Recovery Scenario in UFT - Step8
Recovery Scenario in UFT – Step8
  • Step9# Based on the requirement, we can add this scenario to the current test or to the default test settings. Now, to close the “Recovery Scenario” wizard in UFT, we need to click on the “Finish” button.
Recovery Scenario in UFT - Step9
Recovery Scenario in UFT – Step9
  • Step10# Now, we need to save the recovery scenario in an external file and close.

Scripting and Test Setting Approach:

On-Error-Resume-Next statements: 

It was using the On-Error- Resume-Next statements; the exception can be handled partially. In this approach, the test script block should be started with “On Error Resume Next” statements. It defines that in case of any error, execution will will skip the present step and continue with next step. After that, by checking the error, we can handle the exceptions. Important keywords are –

On Error Resume Next – 

In case of error, UFT will not raise an error message; instead of that, execution will move to the next step.

On Error Goto 0 – 

It will work in reverse procedure with comparison to the above keyword i.e., in case of any unhandled error, an UFT error popup will be thrown with three options – retry, skip and stop.

Error.Description – 

It stores the error description.

Error.Number – 

It holds the error number. For success, the value is zero.

Error.Clear – 

It reset the Error object.

Exception Handling in UFT - On Error Resume Next Statement
Exception Handling in UFT – On Error Resume Next Statement

Using Exit Statements: 

UFT provides some predefined methods which will allow us to handle the exceptions through the scripts. The frequently used methods are –   

ExitActionIteration – 

Use to exit the current iteration of the action. ExitAction – Exits the current action.  

ExitTest – 

UFT will exit from the test execution.

ExitTestIteration –  

Skip the current test iteration and the execution will be continued with the next test iteration.

Using Test Settings:

We can configure the recovery steps by selecting any of the below options from the UFT Test Setting wizards (Run Tab).

Pop up message box 

In case of any error, UFT shows a popup message with error details.

Proceed to next action iteration –

UFT will execute the next action iteration when an exception has occurred.

Stop run –

Execution will be stopped.

Proceed to next step – 

Execution will be resumed from the next step.

Proceed to next test iteration – 

UFT will execute the next test iteration for any error.

Exception Handling in UFT - Test Setting
Exception Handling in UFT – Test Setting

Synchronization in UFT:

Synchronization in UFT is an approach to define the time interface between the tool and the application under test. If the application behavior is slower than the expectation of UFT, the test will be failed. So, synchronization in UFT is another important topic for test automation.

Chances of synchronization errors can be minimized by using either of the below approaches –

Wait:  

The default Wait(timeout) statement is a static method to handle the synchronization errors. Here, timeout denotes the hardcoded wait time in seconds. During the execution, the script will wait for specific time at this point. We need to define the value of timeout based on the application responses.

WaitProperty in UFT:

To use the method WaitProperty in UFT, we need to specify the property name, the expected value of the property and the maximum wait time in mili-seconds. This is a dynamic way to handle the synchronization. Here, the execution will wait till the the property value satisfies with the expected value in the application. If the property value does not match, after the spefied maximum timeout, the script will proceed with the next step. Example –

Window(“<windiow name>”).WinListView(“<view name>”).WaitProperty “visible”,true,20000

  • Loop:

This is an indirect way to handle the synchronization dynamically. We can use a loop with a condition to check the the object’s property value does not satisfied with expected value. In the loop statement, we can provide a small time out value using the Wait(timeout) statement. So, the checking will be done after each timeout and loop will be continued until the object is visible.

  • Test Setting:

 We can define the synchronization timeout in the Test Setting wizard (Run tab and web tab for web navigation timeout). Based on this configuration, UFT will wait for the test objects.

Conclusion:

In this “Exception Handling in UFT ..” article, we have learned about exception handling in UFT along with recovery scenarios and synchronization in UFT. Please click here to get more information on “Exception Handling” from the Microfocus support portal.

UFT Tutorial:Create Test Case–Step By Step Guide For UFT 14.x

Create Test Case in UFT Folder Structure 300x100 1

Software testing is become the most important phase in software development life cycle which ensures the quality of end product. So, with out the successful testing phase, it will be extremely risky to deploy the software product in the production. In today’s busy life, market demands a faster releases of software product with high quality. Here, is come into the picture to reduce the testing cycle with expected quality. There is lots of automation tools are available in the market, but Unified Functional testing (UFT) tool is playing as the key player in software testing domain.

In this Create Test Case in UFT article, we are going to learn about the step by step guidance to create the test case in UFT along with the test framework.

UFT Tutorial – Table of Content

UFT Tutorial #1: UFT Overview

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 

Step by Step Guide to Create Test Case in UFT

UFT is the short form of Unified Functional Testing, which is previously known as Quick Test Professional (QTP). With the help of VB Scripting, test cases build to automate any functional testing scenario.  Here, we are automating a sample application using the tool UFT. We are trying to explain each of the steps to automate the test scenario. First, we will understand the functional scenario which will be automated later in this article –

Functional Test Scenario:

Test Case Summary: Book flights through sample Flights Application.

Step#DescriptionExpected Result
1Open the Flights App (FlightsGUI.exe)The login screen should appear.
2Login with a valid credential (Username- John, Password- HP)Book Flight Screen Should appear.
3Enter below criteria and click on Find Details –  Source: Frankfurt  Destination: Portland  Travel Date: Today + 2 days  Class: Business  Tickets: 1A list of flights available should be displayed.
4Select the first available option and click on the button, “SELECT FLIGHT.”Flight Details screen should appear.
5Enter passenger name and click on “Order” button.A confirmation message with the Order Number should appear.
6Close the application.The application should disappear.

Test Automation Approach:

After analyzing the scenario, we can assume that the application having one major flow, i.e., flight booking, and this flow is applicable for different sets of test data. So, we will follow the below test automation approach to automate this particular scenario.

Framework Identification: Hybrid Framework which will be a combination of data-driven and modular automation test frameworks.

Environment variables: We need to store the configuration information such as application details, user credentials, framework path, etc., in external environment variables.

Test data: In a data-driven approach, we will store the data in the external excel sheet, which will be imported in the test case.

Object Repository: Create a central repository of test objects (i.e. shared object repository) so that multiple test cases can refer it to increase the reusability.

Reusables/Modules: We will create functions as modules to break the scenario into small parts.

Create Testcase in UFT – Step by Step Guide:

Step1 – Folder Structure: 

Below folder structure need to be created to set up the data driven automation test frameworks. The required folders are – 

Scripts  – UFT test cases will be stored here.

DataTable – It’s used to store the test Datasheets.

EnvirnmentFile – External Environment variable(xml) files are kept here.

ObjectRepository – The shared object repository (.tsr file) will be kept here.

The result – Result related files can be stored here.

Library – Function libraries will be stored here.

Create Test Case in UFT - Folder Structure
Create Test Case in UFT – Folder Structure

Step2 – Create XML for External Environment Variables: 

All the configuration or user-related data that are applicable for the entire automation suite need to be kept in an external environment file(XML) so that same can apply to the entire suite. Which needs to be stored in the EnvironmentFile folder. Here below parameters are created – 

ProjectName – It will be used for reporting purposes.

AppPath – The application exe path is stored here.

UserId/UserPwd – Refer to the application credential.

FrameworkPath – Refer to the root path of the test framework’s folder structure.

Create Test Case in UFT - External Environment Variable
Create Test Case in UFT – External Environment Variable

Step3 – Create External Data Sheet:

All the required test data will be store in an external excel file (FlightbookingData.xlsx), which needs to be stored in the DataTable folder. In this excel, column A, i.e., “TestCaseID,” will be used to map the data row with the current test case. 

Create Test Case in UFT - Shared Object Repository
Shared Object Repository (Create Test Case in UFT )

Step4 – Create/Modify Shared Object repository:

· Open the UFT component “Object Repository Manager” to create shared repository..

· Navigate Each of the application screens, as shown below images.

· Add the required test objects into this newly created shared object repository.

· The object repository is created now. Now we need to save the shared object repository in the ObjectRepository folder with the “TSR” extension.

Create Test Case in UFT - Application Overview
Create Test Case in UFT – Application Overview
Create Test Case in UFT - Shared Object Repository
Create Test Case in UFT – Shared Object Repository

Step5 – Create reusables:

Below functions need to be created in a function library which will store in Library folder with qfl extension,

ImportSheetAndSelectRow – Import Datasheet and Select Desire Data Row

OpenApp – Open Application

LoginToApp – Login to the Application

EnterDetailsToFindFlight – Enter details to find flights.

SelectFlight – Select a row to book the flight.

EnterPassengerNameAndOrder – Book the flight and verify the success message.

CloseApp – Close the application.

Create Test Case in UFT - Function Library 1
Create Test Case in UFT – Function Library 1
Create Test Case in UFT - Function Library 2
Create Test Case in UFT – Function Library 2

Step6 – Create Testcase in UFT:

Now we need to create the empty test case in uft and link the external resources. It should be created in the Scripts folder. After the creation of the test case, the external environment XML shared object repository and function library has to be attached with the test case.

Create Test Case in UFT - Associates with External Components
Create Test Case in UFT – Associates with External Components

Step7 – Call the modules:

Now we need to call the reusable modules, stored in the function library, in the local action(based on the test functionality) to complete the development. After this step, the test case will be complete from the automation point of view.

Create Test Case in UFT - Automated Test Case
Create Test Case in UFT – Automated Test Case

Step8 – Perform dry run and check the reports:

No need to execute the test case once to check if the scripts are working as expected. We can perform this check by reviewing the below reports. 

Create Test Case in UFT - Dry Run Result
Create Test Case in UFT – Dry Run Result

Here, based on the logs displayed in the report, we can assume that the test case has been developed correctly.

Conclusion:

In this Create Test Case in UFT article, we have learned about step by step approach to develop the test framework and create a test case in UFT. Please click here to get more information on this topic from the Microfocus support portal.

VB Scripting in UFT–An Excellent Guide for Beginners

VB Scripting in UFT If Else Conditional Statements in UFT 300x124 1

Testing is now the most essential phase in software development process to ensure the quality of the product. Also, without having testing, it will be very risky to release the software to use. The test automation process has changed the testing dimension with respect to effort savings and lightning fast regression cycle. There is many test automation tools are used in the testing industry. But, the most used automation testing tool is UFT.  

In this VB Scripting in UFT article, below topics will be explained with examples –

· Variables in UFT

· Constants in UFT

· Array in UFT

· Conditional Statements in UFT

· Looping Statements in UFT

· Sub and Function Procedures in UFT

UFT Tutorial – Table of Content

UFT Tutorial #1: UFT Overview

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 #4: VB Scripting in UFT

VB Scripting in UFT:

UFT supports VB Scripting as the programming language to write the code for any test cases. VB Script is derived from Visual Basic 4.0 language, which was developed by Microsoft. VB Scripting in UFT is very easy to learn, and it can be used to develop both server-side and client-side scripting.

Variables in UFT:

Variables in UFT are the placeholder that denotes a memory location that stores program information. It can be changed during run time. A variable has been represented by its name to read/write the stored value. Only one type of variant is available in VB Scripting, which can interact with numbers, strings, or dates. Based on the data, the variable is acted accordingly.

If we store any number with the double quotation, then it’s acted as a string type variable. VBScript in UFT allows us to declare the variables with the help of below three statements –

  • Dim
  • Public
  • Private

Dim Statement – Dim is used to declare any variable immediately irrespective of the datatype. One dim statements allows to declare multiple variables which are separated by comma. The scope of this type of variable is within the code block( in the Case of UFT, scope is restricted to the corresponding actions or function or sub).

Dim myVariable

 Dim myVariable1, myVariable2, myVariable3

We can declare any variable immediately by using its name in the code. So, in this case, an additional declaration statement is not required. But, if we keep the statement “Option Explicit” at the beginning of our scripting area, we have to write the variable declaration statement. Otherwise, UFT will throw an error message.

Public statement – If we declare variables as public, the variables are available throughout all the scripts in the suite.

Private statement – If we declare variables as private, variables are available within the script itself.

Assigning Values to Variables:

Using the below structure, we can assign values to the variables using the equal symbole – 

variableNameString = “My Value” //Assign string

variableNameNumber = 1234 //Assign number

Here variable name should be kept on the left side of the equal symbol, where the value should be kept on the right side. For String, the value should be kept within double quote marks.

Scalar Variables – When we store a single value to the variable, it’s represented as Scalar Variable.

Array Variables – When string more than one value in a single variable, it is known an array. We declare an Array Variable with a parenthesis. In the below example, a single-dimension array containing six elements is declared:

Dim myArrayStudents(5)

Here index starts from 0 to 5, so the records will always be one more than the number shown in parenthesis. Value assignments are done in the below way –

myArrayStudents(0) = “Vikram”

myArrayStudents(1) = “Tom”

.

.

myArrayStudents(5) = “Jerry”

Naming Convention:

The standards rule for the naming convention are mentioned below – 

  • It should begin with an alphabetic character.
  • It should not contain an embedded period.
  • Name should be self explanatory.
  • The maximum length should not be exceeds 255 chars.

Constants in UFT:

We can consider a constant as a variable of a number or String whose value will never change. i.e., after defining a constant, it will be acted as a read-only place holder. The VBScript already provides many in build constants variables like , vbOK, vbTrue, vbFalse, vbCancel, and so on. A constant has to be declared and defined using the keyword “CONST” like the below example –

Const MyString = “This is my string.”

Const MyAge = 49

 Within modules, constants are always private, and visibility can not be changed.

Array in UFT:

Array in UFT is a variable that stores a collection of values having the same data type such as number, String, etc. A set of same type elements can be stored in the same memory location where each of the element can be accessed by their reference number which are known as array index. The index of the first element always start from zero value.

While declaring an array we need to define two parts – the logical name of the array and the array subscripts which indicates the highest value of array index. Array indexes are the unique numbers which represent the each element of that array. This index always starts from zero.

It should be declared before use. We can declare an array by the dim statement. Two types of arrays are available in UFT –

·        Local Array – The scope of local array is restricted to the current function or procedure block where it was declared.

·        Global Array – If the array is declared globally or at the start of script, the values of the array (i.e. scope) can be accessed from all the functions or procedures which are defined with in the same vbscript.

Static and Dynamic Arrays:

VBScript allows us to declare static or dynamic array in UFT.

A static array can not be modified during the uft regression. It means, the static array keeps defined number of elements through out the execution.

A dynamic array can be enhanced at any point of time during the test execution.

Declare and assign Values to Arrays:

Declaration statements – Dim myArray(subscriptvalue)

Example: Declaring an array which stores four students name and assigns the value in it.

Dim arrStudents(3)

arrStudents(0) = “Tom”

 arrStudents (1) = “Henry”

arrStudents (2) = “Tina”

arrStudents (3) = “Vicky”

Conditional Statements in UFT:

The conditional statements are most important features of scripting to make it flexible and robust. The mostly used conditional statement in UFT will be explained through out this section.

If-Else Statement:

The If – Else statement is used build the conditional log in the UFT script. The purpose of this statement is to check one or multiple conditions and perform certain activities based on the checking. For an example – Here we will identify the current week day using the if-then-else statement.

If-Else Conditional Statements in UFT
If-Else Conditional Statements in UFT

The multiple elseif statements can be used to check multiple conditions. Also, we can write multiple conditions in the first line of “if statement” which should be separated by logical operators such as OR, NOT, AND, etc.

Select Case Statement / Switch Case Statement:

It is an alternative approach of instead of using multiple if conditions for a single variable. 

The Select-case statement is very helpful for the scenario where based on the different values of a single variable, we need to perform different activities. It’s also know is switch-case-statement. The use of case statement, we can write our script in a organized way. The select case statement execute the conditional expression at the beginning and the result of the conditional expression, will matched with different static conditions in case statement. Here, only the associated steps will be executed for the match case.

For an example – Here we will identify the current week day using the select case statement.

Select - Case Conditional Statements in UFT
Select – Case Conditional Statements in UFT (VB Scripting)

Looping Statements in UFT:

In a situation, where similar codes are executed again and again based on some conditions, it is advisable to use looping statements for better readability and efficiency . In this section, we will discuss about the different kinds of loops with the examples, which are very helpful in UFT scripting. The loops work on conditions or maximum iteration counters. The frequently used looping statements in UFT are explained below –

· Do Loop Statement

· While Loop Satement

· For Loop Statement

Do Loop:

When we need to execute few steps repeatedly based on one or multiple conditions, we need to use the Do Loop statements as it allows to continue the looping based on conditions. The loop will be continued till the conditions are getting satisfied. Here, the conditions are checked at the end of the looping statement. That means, the first iteration is always executed irrespective of the condition checking result. To exit from the middle of the loop for another specific if condition, the “Exit Do” statement can be used. At end of the loop, “while” statement is used for conditional checking. Example – In this example, the loop will be continued, until the counter value reached to 10,

VB Scripting in UFT - Looping Statements in UFT (Do-Loop)
VB Scripting in UFT – Looping Statements in UFT (Do-Loop)

It’s similar to Do-Loop structure. When we need to execute few steps repeatedly based on one or multiple conditions, we can use the While Loop statements as it allows to continue the looping based on conditions. The loop will be continued till the conditions are getting satisfied. Here, the conditions are placed at the beginning of the loop with the help of while keyword. That means, none of the iteration will be executed if the checking of the conditions are failed. To exit from the middle of the loop for another specific if condition, the “Exit While” statement can be used. At beginning of the loop, “while” statement is used for conditional checking. The primary difference between Do-Loop and While-Wend statement is the place of condition checking.

Example – In this example of VB Scripting, the loop will be continued, until the counter value reached to 10,

VB Scripting in UFT -Looping Statements in UFT (While-Wend)
While-Wend Looping Statements in UFT (VB Scripting in UFT)

For Loop:

For– Next statements are defined predefined iteration counter. The loop will be continued till the counter reached the highest value which is specified with “for” keyword. To exit from the middle of the loop for another specific if condition, the “Exit For” statement can be used. At end of the loop, “while” statement is used for conditional checking.

Example – In this example, the loop will be continued for ten iterations,

VB Scripting in UFT - Looping Statements in UFT (For-Next)
VB Scripting in UFT – Looping Statements in UFT (For-Next)

Sub Procedure in UFT:

A sub procedure in UFT is a group of statements which are bounded by the keyword “Sub” and “End Sub” to perform a specific task. It does not return any value. We can pass values to sub procedure as arguments. An empty parenthesis() represents that there is not input arguments. In UFT, the sub is used to create a unit of the functional block for modularization. 

For example, the below code shows that a sub is used to calculate and display the interest value based on the input interest rate, years, and principal amount.

VB Scripting in UFT - Sub Procedure in UFT
VB Scripting in UFT – Sub Procedure in UFT

Function Procedure in UFT:

A function procedure in UFT is a group of statements which are bounded by the keyword “Function” and “End Function” to perform specific activity and return the output. A function procedure in UFT is a block of statements enclosed by Function and End Function statements to perform specific actions. It has the data return capabilities, which is the primary difference with a sub. We can pass values to function procedure as arguments. We need to include an empty parenthesis() when no argument is required. In UFT, Function is used to create a unit of the functional block for modularization. 

For example, the below code shows that a Function is used to calculate and display the interest value based on the input interest rate, years, and principal amount.

VB Scripting in UFT - Function Procedure in UFT
VB Scripting in UFT – Function Procedure in UFT

Conclusion:

In this VB Scripting in UFT article (UFT Tutorial), we have learned about different variables, constants, arrays, conditional and looping statements. Click here to learn more on VB Scripting. Also, if you want to prepare for UFT Interview Questions, please click here.

UFT Tutorial:UFT Parameterization–Best Guide for UFT 14.x

UFT Parameterization UFT Environment Variable

Testing is now an important 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 article, we are going to learn about the different types of UFT Parameterization such as UFT Environment Variables, UFT DataTable Parameters, UFT Action Parameters, Random Number Parameters with practical implementation.

UFT Tutorial – Table of Content

UFT Tutorial #1: UFT Overview

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 #4: UFT Parameterization

Overview of UFT Parameterization:

UFT Parameterization is an approach to feed test data into the test steps through parameter during the run time. It will help us to increase the reusability of test case modules to use in different data criteria. UFT Parameterization is the key to any advanced test framework.

Purposes of UFT Parameterization:

  • UFT Parameterization allows feeding the test data into test cases at run time
  • Easy to maintenance.
  • Increase the script reusability to execute the same steps for multiple sets of test data.
  • In the case of data change, test script modification is not required.
  • We can avoid hard coding in the test cases through UFT Parameterization.

UFT Environment Variables:

UFT Environment variables are used to store the global test data, which can be used across the test suites. Primarily, test suite configuration, test environment-related data are stored here, which are applicable for all the test scripts. Such as Application URL, Report Path, Test Environment name, etc., are stored in the environment variable. 

The syntax for reading/ edit environment variables is “Environment.Value(“ParamName”).” We can view the variables from the Environment tab of the “Test Settings” wizard. 

Classification: Two types of environment variables are available –

Built-in: These are the UFT defined environment variables related to UFT and Test Case information details. Such as TestName, OS, OS Version, etc. This is the read-only variable and accessible from entire test suites.

User-Defined: These types of environment variables are defined by the tester based on the requirements. Again user-defined environment variables are classified into two parts –

·        Internal – It is defined in the specific test case for reading or writing purposes. From the wizard, we can add, edit, or delete user-defined internal environment variables. Also, it can be created during the execution as well by assigning any value to Environment.Value(“ParamName”), the variable will be auto-created. The scope of these variables is restricted to a particular test case.

·        External – It is defined in an external XML file that can be associated with UFT through Load Variable options from the same wizard. These variables can be accessed only for reading purposes. The scope of these variables is the entire suite.

UFT Parameterization - UFT Environment Variable
UFT Parameterization – UFT Environment Variable

Create Internal Environment Variable:

Step1# Open Test Setting from navigation “File->Settings.”

Step2# Click on Environment link from the left navigation to open Environment Section. Also, Select variable type as User-defined.

Step3# Click on the plus icon to add the internal environment variable.

UFT Parameterization - UFT Environment Variable - Internal 1
UFT Parameterization – UFT Environment Variable – Internal 1

Step4# Internal Environment Variable is now created. We can edit or delete the same variable from this screen as well.

UFT Parameterization - UFT Environment Variable - Internal 2
UFT Parameterization – UFT Environment Variable – Internal 2

Step5# From the test, we can read the value using the code –     Environment.Value(“envTestEnvironmnet”)

Create External Environment Variable:

Step1# Create an external XML file as per the below structure. The variables can be defined under the “Name” tag. 

UFT Parameterization - UFT Environment Variable - External XML
UFT Parameterization – UFT Environment Variable – External XML

Step2# Open Test Setting from navigation “File->Settings.”

Step3# Click on Environment link from the left navigation to open Environment Section. Also, Select variable type as User-defined.

Step4# Select the check box “Load variables and ..” and provide the path for the previously created external XML file.

Step5# The external environment variable will be created with a blue font. 

UFT Parameterization - UFT Environment Variable - External
UFT Parameterization – UFT Environment Variable – External

Step6# From the test, we can read the value using the code – Environment.Value(“externalEnvVariable”)

UFT DataTable Parameters:

UFT DataTable is used to store test data, which can be used in the test cases during the run time. Structure wise, UFT DataTable Parameters are looked like Microsoft Excel sheet. Every column of the datatable sheet is referred to as the UFT datatable parameter. We can store different data sets in datatable, which can drive the test execution. UFT Datatable parameters are an essential part of the data-driven test framework. UFT Datatable Parameters are store as default.xlsx file in the UFT Test case folder.

To run a test case for different global datatable rows, we can configure the same in the Test Settings dialog, that can be accessed from menu navigation “File -> Settings -> Run(Tab)” as shown below:

UFT Parameterization - Run Setting
UFT Parameterization – Run Setting

UFT DataTable Classification: 

There are two types of datatable available –

  • Local datatable – Every action has one default datatable, which is referred to as local datatable. It can be accessed across actions. Syntax to access the local datatable –

DataTable.Value(“Param1”,dtLocalSheet) or DataTable.Value(“Param1”,”SheetName”)

Here dtLocalSheet can only be used from the container action of that datatable.

  • Global datatable – Every test case has one default global datatable, which can be accessed across different actions. Syntax to access the local datatable–

DataTable.Value(“Param1”,dtGlobalSheet) or DataTable.Value(“Param1”,”Global”)

Purposes:

  • Test Data parameterization.
  • Easy to implement and maintain the UFT Datatable Parameters.
  • Easy to work with bulk test data.
  • This is the primary component of Automation Data-Driven Test Frameworks.
  • Easily isolate the test data from the code area.
  • This can be updated easily by any nontechnical test user.

DataTable Operations (Mostly used):

DataTable - UFT Interview Questions and Answers
Sample UFT DataTable

Read-Write Operation – 

In the above figure, if we want to access value from the second row of local action, named mainAction, the script will look like –

//Copy data from Param1 to Param2 column.

DataTable.GetSheet(“mainAction”).SetRowCount(2)

tempVariable = DataTable.value(“Param1”,“mainAction”) // Read from dataTable

DataTable.value(“Param2”,“mainAction”) = tempVariable // Update datatable

Add Sheet and Parameter –  

DataTable.AddSheet(“NewSheet”) //Add sheet with name NewSheet

DataTable.GetSheet(“NewSheet”).AddParameter “param_name”,”Default_Value” //Add Parameter

Get sheet count – DataTable.GetSheetCount

Get number of rows – DataTable.GetSheet(“NewSheet”).GetRowCount

Get number of parameters – DataTable.GetSheet(“NewSheet”).GetParameterCount

Delete sheet – DataTable.DeleteSheet(“NewSheet”)

Get current selected row – DataTable.GetSheet(“NewSheet”).GetCurrentRow

Select/Set specific row – DataTable.GetSheet(“NewSheet”).SetCurrentRow(row_number)

Import the Excel sheet into datatable – 

DataTable.ImportSheet fileName, source_sheet, destination_sheet

fileName – External excel file name with path.

source_sheet – sheetname of the external excel source.

destination_sheet – destination tadatable sheet name.

Export Datatable into Excel sheet – 

DataTable.ExportSheet fileName, source_sheet, destination_sheet

fileName – External excel file name with path.

source_sheet – source datatable name.

destination_sheet(Optional) – destination external excel data sheet name.

UFT Action Parameters:

Action parameters are used to define the variables that are accessible in the contained actions. It’s mainly used to pass the test data into called actions and return as output. The parameter can be created from the action properties section.

There are two types of action parameters available –

Input Parameter – Pass value to actions.

Output Parameter – return value from actions.

Action Parameters - UFT Interview Questions and Answers
UFT Action Parameters

Input Parameters: 

We can pass the value as an input parameter as arguments when calling the action. Example –

RunAction “childAction”, oneIteration,inputValu1,inputValu2, outputValue

Here we are passing the value of variables inputValu1 and inputValu2 as an action parameter. Same value can be read from childAction using Parameter(“inputParam1”) and Parameter(“inputParam2”).

Output Parameters:  

We can read the value as an output parameter variable as arguments when calling the action. Example –

function “childAction”, one iteration,inputValu1,inputValu2, outputValue

Here outputValue is the variable that stores the output parameter of the childAction.

Create Action Parameter:

Step1# Open Action Properties section from “View->Properties” navigation.

UFT Parameterization - Create Action Parameter 1
UFT Parameterization – Create Action Parameter 1

Step2# Click on the Add button from the Parameter tab and click on the “Add Input Parameter” or “Add Output Parameter” link.

Step3#: Enter the required details to create parameters.

UFT Parameterization - Create Action Parameter 2
UFT Parameterization – Create Action Parameter 2

UFT Random Number Parameters:

The UFT Random Number parameter helps us to generate random numbers through this specific parameter. The following example returns a random number using the random number settings defined in the p_Text parameter.

RandomNumber(“p_Text”)

UFT Parameterization – Assign Parameters into UFT test step:

Step1# Change the action layout from editor view to keyword view through the menu option “View->Keyword View.”

UFT Parameterization - Assign Parameters 1
UFT Parameterization – Assign Parameters 1

Step2# Click on the value column for any step and click the <#P> icon.

UFT Parameterization - Assign Parameters 2
UFT Parameterization – Assign Parameters 2

Step3# Based on the configuration/ data setup, we can select either of the below four types of the parameter from the corresponding tabs –

  • Test/Action Parameter
  • DataTable
  • Environment
  • Random Number
UFT Parameterization - Assign Parameters 3
UFT Parameterization – Assign Parameters 3

Conclusion:

In this uft tutorial, we have learned about UFT Parameterization such as UFT Environment Variables, UFT DataTable Parameters, UFT Action Parameters with practical implementation. Click here to understand more from the Microfocus support portal. Also, if you want to prepare for UFT Interview Questions, please click here.

UFT Tutorial:Actions,Function Library,Cracking The Code

Action Parameters UFT Interview Questions and Answers

Testing is now an important phase of the software development life cycle to secure the product’s quality. Also, using of untested product can cause the business loss due to faulty coding.

Here automation is playing an essential role in the testing cycle to reduce the efforts and time. There many tools are available for test automation. But, if we consider the broad application coverage, Unified Functional Testing(UFT) tool is very popular for test automation. 

In this topic, we are going to learn about the UFT Actions, steps to working with actions, UFT function library and library creation steps.

UFT Tutorial – Table of Content

UFT Tutorial #1: UFT Overview

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 Actions and UFT Function Library

UFT Actions:

The UFT action component is acted as a container for writing the scripts. The UFT actions allow us to break the entire automated functionalities into small modules. Any automated test cases should have at least one action by default. But, we can use more than one action based on the test design.

Different parts of an Action: 

The overview of different sections which are available in UFT actions are explained below –

Scripting Area – This section contains the actual test scripts.

Local Object Repository – The technical information of test objects are kept here.

Local DataTable – We can store the test data here which will be used in the test script. It’s similar to the excel sheet.

Properties – Through this section, we can pass the test data as input and read the output.

Classification of UFT Actions: 

The UFT actions can be classified into below three types –

Non-Reusable Actions: This types of actions are treated as the private action for the test script. Thus it cannot be referred from the out side.

Reusable Actions:  The reusable actions are treated as a shared action which can be referred from outside. It is used to share the automated common functionalities with the multiple test cases. During the action creation, the reusable checkbox need to be checked to make it as a reusable component. There is two options are available while referring the reusable actions from external places. The options are “Call to an Existing Action” to link the action or “Call to Copy of an Action” to copy the entire action. The primary purpose is to increase the concept script reusability for better maintenance of test cases.

External Actions: When an action has been called from a different action, is called as external action.

Reusable and Non-Reusable UFT ActionsDifferences: 

The scope of non-reusable action is within the same test script, but reusable actions can be accessed from outside test cases.

The non-reusable action is used to create logic of the functional test case, but reusable actions are used to create the reusable components.

Action Parameters: 

The action parameter defines the different input-output data parameters. The input parameters are used to pass the input test data while calling the action and the output parameters are used to return the data from the action to the called actions. We can define the action parameters from the action property section. Two types of action parameters can be defined which are –

Input Parameter – It’s used to pass value to the action as arguments.

Output Parameter – It’s used to return the values from action.

The below example shows the use of input and output parameters of the action –

RunAction “subAction“, oneIteration,inputValue1,inputValue2, outputValue

Here, we are sending the input data through the variables inputValue1 and inputValue2 . From the calling action, the input parameter’s value can be read using Parameter(“inputParam1”) and Parameter(“inputParam2”). Also, the parameter outputParam is used to return the data from action “subAction” through the variable outputValue.

Action Parameters - UFT Interview Questions and Answers
Action Parameters

UFT Actions with Object Repository:

By default, every action contains one local object repository. So the action can use objects from the local repository. Also, we can use any shared object repository to make it more reusable. It is advisable to use a shared object repository for reusable actions. 

Steps to Associate Shared Object Repository: The steps to associate repository are mentioned below – 

Step1# Rightclick on the action icon from the solution explorer section and click on “Associate repository with action” link.

UFT Actions - Associate Repository - Step1
UFT Actions – Associate Repository – Step1

Step2# Local the path for the shared object repository and click on “Open” button.

UFT Actions - Associate Repository - Step2
UFT Actions – Associate Repository – Step2

Step3# Confirm the “Automatic Relative Path Conversion” dialogue to complete the process. It’s an optional step.

Step4# The the associated shared repository is visible in Solution explorer section. Also, we can open it as the read-only mode by double-clicking on it.

UFT Actions - Associate Repository - Step3
UFT Actions – Associate Repository – Step3

UFT Actions with DataTable: 

Another important component of a UFT action is datatable, which is similar to Microsoft Excel sheet. Datatables are used to store data which are used in test cases. 

The UFT datatables are classified into two categories. Those are explained below –

  • Local datatable – The every UFT actions are contain one default datatable. This datatable is known as local datatable. The data available in datatable, can be read or update throughout the actions within same test case. The syntax to access the data are,

DataTable.Value(“Param1”,dtLocalSheet) or DataTable.Value(“Param1”,”SheetName”)

Here, dtLocalSheet is only applicable while trying to access the datatable from the container action.

  • Global datatable – Apart from local datatable, every test case contain one default datatable which is known as Global datatable. It can be accessed across all the actions using either of the below syntax –

DataTable.Value(“Param1”,dtGlobalSheet) or DataTable.Value(“Param1”,”Global”)

DataTable - UFT Interview Questions and Answers
DataTable – UFT Actions

As per the dataTable structure which is shown in above diagram, the script to update data in 2nd row of column “Param1” from column “Param2” of “mainAction” dataTable, will be looks like below –

'Copy data from Param1 to Param2 column.
DataTable.GetSheet(“mainAction”).SetRowCount(2)
myVar = DataTable.value(“Param2”,“mainAction”)
DataTable.value(“Param1”,“mainAction”) = myVar

Working with UFT Actions:

Three different operations can be performed with the actions – 

  • Call to New Action – Create a new action.
  • Call to Copy of Action – Create a new action by copying areusable action
  • Call to Existing Action – Calling an existing reusable action as a reference.

Call to New Action:

Step1# Click on navigation “Design-> Call to New Action” to open new action creation window.

UFT Actions - Call to New Action - Step1
UFT Actions – Call to New Action – Step1

Step2# Enter below details and click on OK to create a new action.

Name – We need to provide the name of the action.

Reusable Action – We need to check it to make the action as reusable.

Description – It’s an optional field to provide a description of the action.

Location – This field defines the position of new action to be placed after creation. 

UFT Actions - Call to New Action - Step2
UFT Actions – Call to New Action – Step2

Step3# Action is created and available in the Solution Explorer section. Now click on “Add” button from Properties section(Parameter tab) to create parameters. After providing the name of Input or Output parameters to create it.

UFT Actions - Call to New Action - Step3
UFT Actions – Call to New Action – Step3

Call to Copy of Action:

Step1# Click on navigation “Design-> Call to Copy of Action” to open “Select Action” Dialogue window.

Step2# Enter below details and click on OK to create a new action.

From Test – Need to select the container test case for the source reusable action which will be copied.

Action – We can choose the target action from the list box options.

Action Description – It’s an optional field to provide a description of the action.

Edit new action properties – We need to check it if we want to edit the properties.

Location – This field defines the position of new action to be placed after creation. 

UFT Actions - Call to Copy of Action - Step2
UFT Actions – Call to Copy of Action – Step2

Step3# Edit the properties such as name, parameters, descriptions etc.

UFT Actions - Call to Copy of Action - Step3
UFT Actions – Call to Copy of Action – Step3

Step4# Click OK to create the action.

UFT Actions - Call to Copy of Action - Step4
UFT Actions – Call to Copy of Action – Step4

Call to Existing Action:

Step1# Click on navigation “Design-> Call to Existing Action” to open “Select Action” Dialogue window.

Step2# Enter below details and click on OK to create the reference of reusable action.

From Test – Need to select the container test case for the source reusable action which will be copied.

Action – We can choose the target action from the list box options.

Action Description – It’s an optional field to provide a description of the action.

Location – This field defines the position of new action to be placed after creation. 

UFT Actions - Call to Exsiting Action
UFT Actions – Call to Exsiting Action

Step3# Reference of existing reusable action will be showing below –

RunAction “testAction”, oneIteration

UFT Function Library: 

Overview of Functions: 

A function is a logical block of instructions. UFT supports the vbscripting. So, we can follow the guidelines to create functions in UFT. Any kind of conditional, logical or looping statements can be developed through the functions in UFT which can be reused from any place. Even, we can automate the functional steps through the functions with the help of shared object repository. It’s always advisable to write the functions in UFT function library which is stored in a external path. By associating the function library, we can access any of the functions from any of the UFT test cases.

As UFT allows to develop the functionality, we can replace any reusable action with the help of functions and shared object repository.

Limitations: 

The limitations are explained below for the function library.

  • By default, the UFT function library has no dataTable or object repository..
  • The UFT functions can not be executed as a standalone. To execute it, it has to be called from any action.
  • The function library is an optional component of UFT.
  • Always, we need the help of shared object repository or descriptive programming approach to automate any application functionalities.

Functions and UFT Actions – differences:

  • The functions are not build with default object repository and dataTable. But the UFT actions have both the default component.
  • The functions can not be executes as an individual component but any action can be executed stand alone.
  • It is easy to maintain the functions with compare to actions.
  • The use of multiple action can increase the weight of the test scripts which impacts the test execution. But, functions are light weighted which helps to improve the performance.
  • Actions are the mandatary component but functions are optional.

Overview of UFT Function Library:

UFT Function Library is the container of the functions. The user functions can be written in the function library using VBScripting coding method. If we want to work with objects, we need to use the shared object repository. 

Steps to create the UFT Function Library:

Step1# Use the menu option “File->New->Function Library” or “Shift+Alt+N” to open the function library cretion dialogue.

Step2# Enter the location and file name to create the function library with qfl extension. 

UFT Function Library Creation Step2
UFT Function Library Creation Step2

Step3# Now, we need to associate the function library in the current test case by clicking on the “Associate Function Library with Test” option.

UFT Function Library Creation Step3
UFT Function Library Creation Step3

Step4# The function library is now showing under the Solution explorer section. We can write our function using Vbscripting in the library. 

UFT Function Library Creation Step4
UFT Function Library Creation Step4

Conclusion:

In this article about UFT Actions and function library, we have learned about about uft actions, classifications and step by step guidance to create different types of UFT Actions and UFT Function Library. Click here to understand more from the Microfocus support portal. If you want to get the flavors of frequently asked UFT interview questions, please click here.

UFT Tutorial: Object Repository – Best Guide for UFT 14.x

UFT Object Repository Object Spy 157x300 1

Testing is now an important 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 topic, we are going to learn about the UFT Object Repository, descriptive programming approach and concept of virtual object in UFT, which are the most important features of UFT.

UFT Tutorial – Table of Content

UFT Tutorial #1: UFT Overview

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 #3: UFT Object Repository

UFT Object Repository:

An object repository is the primary component of UFT as an automation test tool. It is the collection of test objects which are used to map the applications with the UFT test scripts. Basically, one or multiple properties that can uniquely represent any test objects of the application are stored in Object Repository. For example, name, id, inner text, these are the common properties used to represent any object. It follows the below properties to identify the field objects –

Mandatory property -> Assistive property -> Ordinal Identifier -> Smart Identification

Object Repository Classification: 

Two types of object repositories are available in UFT –

  • Local Object Repository
  • Shared Object Repository
UFT Object Repository - Local
Local Repository

Shared Object repository – An object repository that is located outside of the test case is known as a shared object repository. It can be shared across multiple actions or test scripts. We can build it with the help of the object repository manager. It’s used for reusability purposes. We can store it as a .tsr file in any location. This type of object repositories is mostly used for reusability purposes in Keyword or Hybrid test frameworks.

UFT Object Repository - Shared
Shared Repository

Guideline for Object Repository: 

  • The logical name of the objects in the repository should be given based on the application functionality.
  • Smart identification should be disabled to increase performance.
  • Object Repository size should not be big; descriptive programming can be partially used to reduce the size.
  • Handle dynamic objects through regular expressions or descriptive programming.
  • Use a shared object repository instead of a local.
  • Do not use multiple entries for the same object in Repository.

Different Options in Object Repository:

ObjectFinder – This is one of the most important and helpful features of UFT to analyze the test object. Through this option, we can view/analyze the different properties of test objects before adding them to Object Repository. It will help us to define the object identification approaches for test automation. Without object Finder, it is very difficult to define the descriptive programming approach.

UFT Object Repository - Object Spy
Object Finder

Add Object – It’s used to add any application object into the repository.

Update from the application – We can update any objects which are already added to the repository directly from the application through this option.

Highlight – Object can be highlighted in the application.

Locate in Repository – We can locate the actual object available in the repository from the application.

Object Properties section – Descriptive properties, ordinal identifier, and smart identification configuration can be view/ edit from this section.

UFT Object Hierarchy: The UFT test object hierarchy includes one or multiple levels of test objects. The highest level of the object may represent a window, dialog box, or browser type object, depending on the environment. For any web applications, three levels of object hierarchies are available – Browser, Page, and individual test object. So, the identification has been made sequentially from top to bottom.

Browser(“Test Browser”).Page(“Test Page”).Link(“test link”).Click

Object Identification Mechanism:

Objects from the repository can be identified based on the properties or behavior as appeared in the application. There are three different types of property options that are available to locate any object uniquely. Those are –

Descriptive Properties – Based on the application development, behavior or properties are defined in the application. It has two parts – Mandatory properties and assistive properties. Based on the uniqueness of the properties, UFT is able to identify the objects. First, the tool is to try to identify the Mandatory properties such as name, id, text, etc., which are defined during the application development, are used to identify the object. If any unique combination is not available, UFT is trying to identify the application with the help of some additional properties, which are referred to as assistive property. 

Ordinal Identifier – When the descriptive properties are not sufficient to identify any object uniquely, UFT is trying to define some additional properties based on the appearance of the objects in the application to identify. These properties are called an Ordinal Identifier. Three types of ordinal identifiers are available –

Index – it’s defined based on the position of the object in the application. Index value always starts from 0.

Location – it’s defined based on the location of the object in the application. The location value always starts from 0.

CreationTime – it’s defined based on the creation time of the object in the application. The value of CreationTime always starts at 0.

Smart Identification – When Descriptive properties and Ordinal Identifiers are failed to identify any object, some additional configuration/properties are used, which are predefined to identify the objects in this case. Smart Identification is the last option to identify the objects. It’s only applicable if we set the value as true. But this feature has slowed down the test execution. So, as best practices, in most cases, we need to disable these features.

UFT Object Repository - Property View
Property View of Repository

Step by step guide to add Objects:

  • Open the test application and move to the desire page/screen to add objects.
  • Open local object repository from UFT by clicking on the Object Repository icon or pressing “Ctrl+R” keys. In case of a shared repository, we can open it from “Resources-> Object Repository Manager.”
  • Click on the add object button(Green plus button) in the repository. Now the tool will allow us to select the object by clicking on the desired field in the application.
  • After the selection of an object, an intermediate “Object Selection – Add to Repository” popup will appear. Click on the OK button to add the object.
  • After adding the object, we can edit the properties or logical names based on the requirements.

Object Repository Manager:

Object repository manager is used to manage/ work with a shared repository. We can add, update, delete objects from the shared repository through the wizard. Navigation to open – Resources -> Object Repository Manager.

How to Create a Shared Object Repository:

The different approaches are – 

  • Create through Object Repository Manager – Open “Resources-> Object Repository Manager” and add objects from this window. After adding objects, we can save it as a .tsr file to create a shared object repository.
  • Converting Local Repository into Shared Repository – Exporting the local object repository (File -> Export Local Objects) into a shared object repository.
  • Drag Drop approach – Drag the objects from the Local Repository and drop them into a shared repository.

Associate Shared Object Repository in action: 

Two options are available –

  • In the Solution Explorer of UFT, right-click on the action name node and select the Associate Repository with Action.
  • In the Open Shared Repository dialog box, select the object repository and click Open.

Object Repository Comparision Tool:

This is used to compare two shared repositories and identify the mismatches. 

  • This tool can be opened from “Object Repository Manager” by the following path – “Tools-> Object repository Comparision Tool.”
  • Select both the shared repository and press on OK button.
  • Now comparision details will be available to analyse.
UFT Object Repository - Object Repository Comparision Tool
Object Repository Comparision Tool

Object Repository Merge Tool:

This is used to merge two shared repository into one. 

  • Merge tool can be opened from “Object Repository Manager” by the following path – “Tools-> Object repository Merge Tool.”
  • We need to select the primary and secondary repositories for merging. 
  • Now analyze the conflicts and save for merging both the repositories into the primary repository.
UFT Object Repository - Object Repository Merge Tool
Object Repository Merge Tool

Handling Dynamic Objects: 

Two options are available to handle dynamic objects – 

  • Descriptive programming approach – We later about descriptive programming in this article.
  • Regular Expression – It’s a series of characters that form a pattern/string which is used to identify the objects. We can define it by replacing the dynamic part of any properties with wild characters. Let see the below example – 

We have a dynamic link with text as – “Current date is 03-04-2000”. Here we can observe that in this link, the “Current date is “ part is constant by rest part is getting change every day. So we can use the either of below pattern while defining the objects in Object Repository –

Current date is .*” – Here ‘.*’ represent any string of any size.

Current date is \\d\\d-\\d\\d-\\d\\d\\d\\d” – Here ‘\\d’ can replace one numeric digit only.

Similarly, there are more regular expressions available. Please click here to see that.

Descriptive Programming:

Descriptive programming is an approach to define the description of the object during execution time. Through this approach, we can execute the test cases when the objects are not stored in the object repository. 

The purposes of using the Descriptive Programming approach are –

  • The test object is dynamic in nature.
  • To execute test cases without adding objects in Object Repository.
  • Execution performance may decreases if we use a big Object Repository. Descriptive programming can be used to avoid it.
  • ChildObjects are used to create a collection of objects which are matched based on the defined object descriptions. The parent objects proceed ChildObjects. Example – refer above example.

Working with descriptive Programming: 

There are two ways to develop test cases using descriptive programming –

1. Description Objects – Script is created using the Description object with the required properties. Example – Below descriptive programming approach is used to find the number of links available on a particular webpage.

UFT Object Repository - Descriptive Programming
Descriptive Programming

2. Description Strings – The Description of the object are passed as a string during the test case creation. Example –

                               Browser("MyApp").Page("MyApp").Link("text:=login","type:=Link").Click

Comparision Study between Object Repository and Descriptive Programming:

Object RepositoryDescriptive Programming
Object need to be added here.No need to add object in OR.
Difficult to handle dynamic objects.Easy to handle dynamic objects.
Reduce the performance of the execution.Increase the performance of the execution.
Object need to be defined prior to execution.Objects are defined during execution.

Virtual Object in UFT:

Sometimes, we have observed that objects in test applications are not recognized by the UFT for automation. Instead of that, the entire region identified as standard window objects. To handle this kind of scenario, UFT provides a feature as a virtual object to define those unrecognized objects as Button, link, textbox, etc., based on their behavior.

We can open the virtual object creation wizard from the path – “Tools-> Virtual Object->New Virtual Object.” By following the step by instruction from this wizard, we can define the Virtual Objects.

Limitations of Virtual Object are –

  • UFT is not able to record the virtual objects.
  • It’s not controlled by Object Repository.
  • Checkpoints can not be added here.
  • Object Finder can not inspect the virtual objects.
  • Execution may fail if the screen resolution has been changed.

Creation of Virtual Object in UFT:

1. Open Virtual Object Manager from navigation “Tools-> Virtual Object” and click on New button.

2. Click on Next from “Welcome to Virtual Object Manager” screen.

New Virtual Object Screen 1
New Virtual Object in UFT – Screen 1

3. Select class and click Next from “Map to a Standard Class” screen.

New Virtual Object Screen 2
New Virtual Object in UFT – Screen 2

4. Now mark the test object from application using mouse and click on next.

New Virtual Object Screen 3
New Virtual Object in UFT – Screen 3

5. Now configure the object and click next.

New Virtual Object Screen 4
New Virtual Object in UFT – Screen 4

6. Now click on Finish to save virtual Object.

New Virtual Object Screen 5
New Virtual Object in UFT – Screen 5

Conclusion:

In this article about UFT Object Repository, we have learned about how to identify objects from the application under test and the classification. Click here to understand more from the Microfocus support portal. Also, if you want to prepare for UFT Interview Questions, please click here.

UFT Tutorial: UFT Overview (Beginner’s Guide!)

UFT Overview

After developing, the software product has to be passed through the testing phase to ensure the quality. In the testing life cycle, test automation has a brighter future as it has the ability to reduce the testing cycle and cost with expected quality check. Many tools are available for test automation, but if we consider the broader application coverage, the Unified Functional Test(UFT) tool is one of the key player.

Through out this “UFT Overview” article, we will go through the basics of testing and overview of different components which are available in UFT.

UFT Tutorial – Table of Content

UFT Overview

About Software Testing:

Testing has the importance for cross verification of the end product. Testing can be done in different phases of software development life cycle. We can perform the software testing in two ways – manually or through test automation. We will talk about test automation through out the tutorials. 

The purposes of software testing are explained below –

  • Verification of the quality of the end product..
  • Find and fix the bugs before deploying the software in production.
  • Testing can assure about the software requirement.
  • Report if there is any performance or security issues.

The classification of software testing are explained below –

  • Unit Testing – This type of testing are done in the development phase by the application developer.
  • Integration Testing – After the development, when all the components are integrated, the integration testing is required to ensure the interfaces and the different software components are working as expected.
  • System Testing – This type of testing is done before delivering the end product. The functionalities of the product are tested in this phase.
  • User Acceptance Testing – The User Acceptance Testing(UAT) is done by the business users to check the requirements before deploring the product into production. This is a blac-kbox testing.
  • Regressing Testing – Regression testing is required to verify the business-as-usual functionalities during the application enhancements.

About Automation Testing:

In todays life, time is an important criteria for the software testing process. So, there is a high demand to reduce the test execution cycle without compromising with the quality. In this particular aspect automation testing is come into the picture. Automated testing is nothing but the testing has to be done automatically without spending any human efforts. Many tools are available to perform test automation like RFT, QTP (UFT), and Selenium. But, considering the application coverage and flexibility, UFT is ruling the test automation industry. In this tutorial, we will provide an overview idea of UFT as a test automation tool.

The key features of test automation are mentioned below –

  • Automated test execution is always very fast with compare with manual testing cycle.
  • Common human errors can not be replicated in test automation.
  • It reduces the test execution cycle time which helps to reduce the entire software development life cycle as well.
  • Ensures the quality by covering more functionalities.
  • Parallel test execution can be done.

About UFT Overview:

UFT is the short form of Unified Functional Testing, which is previously known as Quick Test Professional (QTP). With the help of VB Scripting, test cases build to automate any functional testing scenario. The primary merits of UFT over other test automation tools, are specified below –

  • Test automation process is simple and easy to learn the tool in a shorter span of time.
  • Automation can be done through the recording.
  • Identification of test object is more efficient and robust.
  • It’s easily compatible with different standard test automation frameworks.
  • It has more application coverage. The famous application platforms (e.g., Web, SAP, SFDC, mobile, etc.) are compatible with UFT.
  • UFT supports web service testing(API) and XMLs.
  • It supports vbscripting which is easy to learn
  • We can easily integrate the UFT with ALM as a test management tool.
  • It has an in-build excel sheet like dataTables which helps to develop test data driven approach easily.
  • In-build reporting is available with the tool during execution.

Different important components of UFT are specified below –

  • Action –Actions are the actual container of the test scripts i.e., we can develop the test case in a action. The application functionalities can be broken into small logical blocks/ modules using the actions.
  • Object Repository – The technical properties of test objects are stored in object repository (OR) which are used to develop the automated test cases in UFT.
  • Datatable – The another important features of UFT is datatable which is used for test data management. Based on the usage and looks, it’s comparable to Microsoft excel sheet. We can add, edit, delete data at any time from the datatable. The datatable allows us to design the data-driven automation test framework.
  • Function Library – The function library in UFT, contains the user defined functions and sub procedures. Conceptually, function is a block of codes or statements which are used to perform a specific task. To access the functions from the function libraries, first, we need to associate the library with the UFT test cases.
  • Environment Variable – UFT allows us to store configuration related test data which will be accessible through out the entire test suite in a special kind of variables. This variables are known as environment variable. Three types of environment variables are available – In built, internal user defined and external user defined environment variables. Details on environment variables are available here.
UFT Overview
UFT Overview

About Automation Test Framework: 

The automation test framework defines some standard guidelines which help to perform test automation test activities in a organized and efficient way. The purposes of automation test frameworks as specified below –

  • Use the same standards through out all the test cases.
  • Increase the speed of test automation activities such as development, execution, maintenance etc.
  • Easy to debug the failed test cases.
  • Using of predefined standards, there is better readability.
  • Reduces the test execution efforts by implementation of unattended execution.
  • Test data can be managed in a structured way by defining the proper frameworks.

In the below section, the all types of automated test frameworks are explained –

Linear Automation Framework –

This type of automation test frameworks are also known as record and play framework. The reason behind this naming convention is that the test cases are created by recording the test scenario by the UFT Recording feature. This type of test case does not contain data parameterization, reusable components etc. Here, the test cases can be created quickly with minimum skillset of tester. This test framework is popular for one time test execution but not advisable to use for long run. As it needs much more maintenance efforts if we compare with other frameworks.

Modular Driven Framework – 

The name suggest that test cases are driven by reusable modules which means that the entire test scenario is broken into small parts as modules. By clubbing the modules, we can create the test cases. The modules can be created using reusable actions or procedures with the help shared object repository. Before starting the scripting, we need to analyze the entire test scenarios and identify the small sections which can be reused again and again.

As the modules are the driver in this test framework, the test maintenance efforts are very less if we compare with linear test framework. This framework approach is very useful for any application where different test flows are available.

Data-Driven Framework –

As per the name suggest, the test cases are driven by test data in data-driven test framework. The test data can be stored in datatables, excel sheet, databases or csv files which will be fetched and used during the test execution. This framework is very useful for applications where single flow is available and based on different data criteria, different test cases are created. It minimizes the number of test cases as same test case can be executed for different set of test data. Thus, it reduces the maintenance efforts as well.

Keyword Driven Framework – 

The keyword-driven test framework is also called the table-driven testing. The first step of this framework is to develops the keys which represent the small modules such as invoke, login, enterData, clickSubmit, verify, logout, etc. Then, by specifying the keys in predefined excel or datatable along with data and operation, we can develop the test cases. In this framework, one driver script is required which reads the excels or datatable and perform the corresponding task as per the keys. This is best fitted for small projects and due to usage of reusable keys, the maintenance efforts are very less. The main disadvantage of this keyword driven framework is the complexity.

Hybrid Test Framework –

By combining two or more test frameworks which are explained above, we can define the hybrid test frameworks. This types of frameworks are mostly used for any test automation projects.

UFT Overview - Test Framework
UFT Overview – Test Framework

Conclusion:

In this article about UFT Overview, we have learned about the overview of automation testing, components of UFT, and test frameworks. Click here to understand more from the Microfocus support portal.

UFT Setup – Complete HandsOn Guide And Steps!

UFT Setup Registration to Download UFT

Through out this UFT Setup article, we will explain the step by step approach of UFT Setup, which includes download. Install, License Configuration, and ALM Connection.

The software testing now the hot topic on software development life cycle to ensure the quality of the end product. Also the marked demands the faster delivery of the product with the best quality. On this aspect, test automation plays the major role to reduce the test cycle time. In the market, different types of automation test tools are available. But, Unified Functional Testing (UFT in shorter form) is playing the key role in the market.

UFT Tutorial – Table of Content

 UFT Tutorial #2: UFT Setup

Download UFT:

  • Step1: Open the microfocus site and click on the corresponding link to download the latest UFT.
  • Step2: Enter the below details to register for the UFT Trial version.
UFT Setup - Registration to Download UFT
UFT Setup – Registration to Download UFT
  • Step3: Click on Start Free trial to download software and unzip it if required.

Install UFT

  • Step1: Uninstall the existing UFT version from the system (if any).
  • Step2: Execute the setup file with Admin privilege, which was downloaded previously.
UFT Setup - Install UFT Step2
Install UFT Step2
  • Step3: Enter the location to extract temp files and click on Next.
UFT Setup - Install UFT Step3
Install UFT Step3
  • Step4: Update window components (if required). Click OK.
UFT Setup - Install UFT Step4
Install UFT Step4
  • Step5: Click on the Next button and accept terms and condition
UFT Setup - Install UFT Step5
Install UFT Step5
  • Step6: Select required Addons to automate corresponding applications. Also, the Installation directory can be modified from here.
UFT Setup - Install UFT Step6
Install UFT Step6
  • Step7: Keep the default selection and click on the Install button and wait for the completion of the installation.
UFT Setup - Install UFT Step7
Install UFT Step7
  • Step8:  Click on the Finish button to close the setup wizard.
UFT Setup - Install UFT Step8
Install UFT Step8
  • Step9: Install Microsoft Script Debugger by executing scd10en.exe file with admin privilege. The script debugger is available in Microsoft’s official page to download.

UFT License Configuration

  • Step1: Open the UFT with admin privilege(for the first time only).
UFT Setup - UFT License Configuration Step1
UFT Setup – UFT License Configuration Step1
  • Step2: Click on the Install Licence button from the error message(if it appears).
UFT Setup - UFT License Configuration Step2
UFT Setup – UFT License Configuration Step2
  • Step3: Click on the “Concurrent License” section.
UFT Setup - UFT License Configuration Step3
UFT Setup – UFT License Configuration Step3
  • Step4: Enter the License server as “mlgccu01devat02” and click on Connect. Some time error may appear (in the error case, retry for a couple of times after restarting the server)
UFT Setup - UFT License Configuration Step4
UFT Setup – UFT License Configuration Step4
  • Step5: If connection success, click on the INSTALL button.
UFT Setup - UFT License Configuration Step5
UFT Setup – UFT License Configuration Step5
  • Step6: License server connected successfully now. Click on EXIT WIZARD and reopen the UFT tool.
UFT Setup - UFT License Configuration Step6
UFT Setup – UFT License Configuration Step6
  • Step7: After the successful installation of the license server, the below addon selection screen should appear.
UFT Setup - UFT License Configuration Step7
UFT Setup – UFT License Configuration Step7

ALM Connection

ALM is used as a script repository of UFT test cases. Also, we can manage the test execution, status reporting, defect management through the ALM. In this section, we will learn how to connect ALM from the UFT.

  • Step1: Open the UFT with admin privilege. Admin access is required to download the required DLL files to establish a connection with ALM. This is a one-time activity.
  • Step2: Select required addon and click OK to open UFT…
  • Step3: Click on the “ALM Connection” icon.
UFT Setup - ALM Connection Step3
UFT Setup – ALM Connection Step3
  • Step4: Enter ALM Server URL and user credential. Server URL – http://xxxxxxxxx/qcbin/ and click on Connect.
UFT Setup - ALM Connection Step4
UFT Setup – ALM Connection Step4

It will take a couple of minutes to download ALM components(DLLs).

  • Step5: Select the ALM projects and click on the Login button.
UFT Setup - ALM Connection Step5
UFT Setup – ALM Connection Step5

Conclusion:

In this article about UFT Setup, we have learned about how to download, install, and configure UFT for test automation. To know more details on UFT from support portal, please click here. Also, if you want to prepare for UFT Interview Questions, please click here.

61 UFT Interview Questions and Answers That You Should Know

Sample Code 1 UFT Interview Questions and Answers

Now-a-days, the demands of test automations are getting increased rapidly to save time and money. Many tools are available to automate the software testing process in the IT industries. But, if we consider the different aspects like the flexibility of scripting, easy maintenance, rapid development, then we have to choose the Unified Functional Testing(UFT) tool, which was previously known as Quick Test Professional (QTP).

Through out this “UFT Interview Questions and Answers article”, we are going to show case the frequently asked UFT Questions and answers which will gives you more exposures for UFT Interviews. The UFT Interview Questions and Answers article will also help to get the preparation to face UFT job interviews.

Top UFT Interview Questions and Answers

Q1. What is Software Testing?

Ans: Testing is a process to check the readiness of the end product with expected quality. There are multiple levels of testing are defined throughout the software development process. The software testing can be done through manual or automated process.

Q2. Why is testing required?

Ans: Purposes of testing –

  • Ensure the quality of software products.
  • Identify issues or break in an application before the production deployment.
  • Ensure all the business requirements are fulfilled.
  • Identify if there are any performance issues.

Q3. What are the various testing approaches?

Ans: Different types of testing are specified below – 

Unit Testing – Done by the developer during the software development phase.

Integration Testing – It is done by the tester during the integration phase of different software components.

System Testing – It’s done to ensure the overall quality of the software products after completion of integration testing.

Integration Testing – This is done after the integration of different components/subsystems for any application.

User Acceptance Testing – It is done by the receiver of the product to check the fulfillment of all the requirements.

Regressing Testing – This done to check the business as usual processes of the application after any major or minor code drop.

Q4. What is automation testing?

Ans: Nowadays, there is a big opportunity for software testing to be done fast and efficiently with proper quality assurance. So, the test automation is the perfect solution which means testing can be done through tools/robots to reduce the efforts and increase the effectiveness.

Q5. Why automated testing is so important?

Ans: The importance of automation testing are –

  • Fast test execution cycle.
  • Avoid human errors during testing.
  • Reduce the manual test execution efforts.
  • Reduce the time of the overall software release cycle.
  • More test coverage ensures better software quality.
  • Parallel execution can be possible.

Q6. What are the major automated testing tools available in the market?

Ans:  The major tools which are available in the market are – UFT, Selenium, RFT, Tosca, etc.

Q7. What is the full form of QTP, UFT, ALM, QC? 

Ans: 

QTP – Quick Test Professional

UFT – Unified Functional Testing

QC – Quality Centre

ALM – Application Lifecycle Manager

Q8. Explain the merits of UFT tool?

Ans: The merits of UFT are mentioned below –

  • Easy to automate and learn the tool.
  • An automated test case can be developed by recording any test scenarios.
  • An object identification process or approach is easy and more effective.
  • It supports all the standard automation test frameworks.
  • Automation of major application platforms (e.g., SAP, Web, SFDC, window, mobile, etc.) are possibles.
  • Web service testing is possible also supports XML.
  • It follows VBScripting for writing test cases, which is easy and simple.
  • Easy to embed with test management tool ALM.
  • It supports data tables and excels, which will help to parameterize the test data easily.
  • It provides a default test reports with export features.

Q9. What is automation test frameworks? Explain the benefits?

Ans: Automation test framework is a set of technical rules or guidelines to automate test cases in an organized and effective way. The benefits of the implementation of test frameworks are –

  • Follow the same guideline throughout the test case developments.
  • Enhanced the speed of different automation testing process.
  • Easy to maintenance.
  • The application can be tested accurately.
  • Continuous testing can be possible.
  • Better readability of the test suite.

Q10. Explain the concepts of different test frameworks? Which test frameworks are commonly used, and why?

Ans: The standard automation testframeworks are –

Linear Automation Framework – This is also known as Record and Playback framework as it’s generated during the recording. Test data parameterization, script reusability concepts are not used here. Due to this, we can create test cases quickly. This framework is not suitable for the long run.

Modular Driven Framework – As per this Framework, the tester can break the entire application into small modular test scripts based on the smallest part of requirements. After the creation of modules, the tester can develop the test cases based on the small modules.

Due to the usages of modules, script maintenance is easier than compare the Linear automation framework. This approach is helpful for distributed applications where multiple test flow is available.

Data-Driven Framework – In this framework, the test cases are created based on the test data. It means, test data drives the test cases. The test data is fetched from the external sources such as Excel, CSV files, databases, etc., and they are loaded in variables. As data is parametrized, so the same test case can be used to test multiple scenarios based on different data set. It reduces the number of test cases.

Keyword Driven Framework – It is also known as table-driven testing. The automation test scripts are developed based on the keywords which are mentioned in the excel sheet. Each keyword is referring to small script modules. The keyword-driven framework is ideal for small test projects. Here, a single keyword can be reused in multiple test cases.

Hybrid Test Framework – This type of frameworks are defined by referring the concepts of more than one standard test automation frameworks. This framework is commonly used for test automation. Based on the test applications, the different suitable frameworks are identified and combined to develop hybrid frameworks.

Q11. What are the different components of UFT?

Ans: Primary components are mentioned below –

Actions – This the scripting area where actual codes are written here.

DataTables – Use to keep the test data.

Object Repository – This is a collection of technical information(properties) of test objects.

Function library – All the functions are kept here.

Environment Variable – Use to define the framework configuration, application platform-related data, which can be used throughout the entire test suite.

Q12. What is Action? Explain the classifications?

Ans: Action is basically acted as a container where we can write our test scripts. Through the action, we can break the entire functionalities into small logical steps/modules. Every script should contain at least one. But we can create/refer multiple actions based on the requirements. There are two types of actions available –

Non-Reusable Actions: This type of action can be called in the same script only.

Reusable Actions:  This type of actions can be linked from external UFT test cases.

Q13. What are reusable actions? Explain the purpose.

Ans: This is one kind of action that can be reused from multiple test scripts. It provides the reusable feature of UFT. While creating actions, we need to check the reusable checkbox to make it reusable actions. After that, we can call it from other test scripts by following the option “Call to an Existing Action” for linking or “Call to Copy of an Action” for copying the reusable actions.

It’s mainly used for script reusability purposes to reduce the no of test cases. Indirectly, it will help for better script reusability.

Q14. Explain the main difference between local and reusable actions?

Ans: The scope of local action is restricted to with in the same test case, but the reusable actions can be used from the external test cases.

Local actions are used for building the logic of a particular test scenario, but reusable actions are developed as a module to cover the common functionalities that can be reused.

Q15. What are the different parts of actions? Explain.

Ans: The major parts of actions are –

Scripting Area – It’s used to write the scripts.

Local Object Repository – Contains the objects which can be used in the scripting area of that action.

Local DataTable – It contains the test data which can be used in that particular action.

Properties – The input/ output parameters can be defined here.

Q16. Explain the differences between UFT script view and the keyword view?

Ans: In the scripting view, we need to write the logic as a script. But in the keyword view, we can view the scripts as a keyword and can be modified by selecting the configuration.

Q17. How can we create a reusable action?

Ans: While creating actions, we need to check the reusable checkbox to make it reusable actions.

Q18. What is an object repository? Explain the purpose of it.

Ans: The Object repository (OR) is the collection of technical information(properties) for the test objects which is used to map the application with the test case. Basically, different types of properties of the application fields are stored in OR as an object. The properties are used to uniquely identify the test object. It is advisable to follow the below sequence of object identification mechanism through the OR –

Mandatory property -> Assistive property -> Ordinal Identifier -> Smart Identification

Q19. Explain the classifications of OR?

Ans: The OR is classified into two categories –

Local Object repository – The scope of local object repository is restricted to with in the same action. The local OR is created as mtr file within the test folder.

Shared Object repository – The shared object repository can be access from multiple actions and test cases. The shared object repository can be defined with the help of object repository manager utility. It is created with the tsr file extension.

Q20. Explain the ideal framework to use a common object repository?

Ans: The common object repository component of UFT is ideal for keyword driven, modular and hybrid frameworks.

Q21. What is the .tsr file?

Ans: Shared object repositories are saved as .tsr file.

Q22. What is the .mtr file in UFT?

Ans: Local object repositories are saved as .mtr file.

Q23. Explain the different components of the object repository?

Ans: Different parts of the object repository are –

Object Finder – It’s used to inspect or analyze the technical properties of test objects at any point of time.

Add Object – Any object an be inserted into the repository through this option.

Update from the application – This option allows us to update the properties for the existing objects with the reference of the application.

Highlight – It allows to highlight the selected object in the application.

Locate in Repository – It allows us to locate the object in object repository from the application.

Object Properties section – Different types of object properties can be viewed/edited from this section. The properties includes mandatory properties, ordinal identifier, smart identification, etc.

Q24. Explain the object identification mechanism in UFT?

Ans: The test objects can be identified based on the technical properties which are defined during the application development or the behaviors during the appearances. The UFT uses some mechanisms to identify objects which are explained below –

  • Descriptive Properties – The technical properties of test objects which are defined during the application development, are treated as descriptive properties in UFT. This properties should be the first choice for object recognition. The descriptive properties are the combination of mandatory and assistive properties. If the mandatory properties fail to identify any object uniquely, we need to go for the assistive properties for object recognition.
  • Ordinal Identifier – We need to use the ordinal identifier while both the descriptive properties are not able to identify the object. The ordinal identifiers are defined by the UFT based on the appearance, location of the test objects. Three types of ordinal identifiers are available in UFT –

Index – It’s defined based on the appearance of the test object. The index value for the first occurrence of the object is always starts with zero.

Location – It’s defined based on the location of the test object. The location value for the first occurrence of the object is always starts with zero.

CreationTime – It’s defined based on the creation time of the test object. The creationtime value is always starts with zero.

  • Smart Identification – When both the above mentioned approaches are failed, the UFT is trying to identify the test object based on some pre-configures additional properties. This approach is known as smart identification. It should be the last option for object identification. This approach is applied to objects which are available in OR if we select the “Smart Identification” value as true. As per the best practice, we should disable it as it slow down the test execution.

Q25. What is an ordinal identifier?

Ans: We need to use the ordinal identifier while the descriptive properties are not able to identify the object. The ordinal identifiers are defined by the UFT based on the appearance, location of the test objects. Three types of ordinal identifiers are available in UFT –

Index – It’s defined based on the appearance of the test object. The index value for the first occurrence of the object is always starts with zero.

Location – It’s defined based on the location of the test object. The location value for the first occurrence of the object is always starts with zero.

CreationTime – It’s defined based on the creation time of the test object. The creationtime value is always starts with zero.

Q26. What is Smart Identification?

Ans: When both the descriptive properties and ordinal identifiers are failed, the UFT is trying to identify the test object based on some pre-configures additional properties. This approach is known as smart identification. It should be the last option for object identification. This approach is applied to objects which are available in OR if we select the “Smart Identification” value as true. As per the best practice, we should disable it as it slow down the test execution.

Q27. What is descriptive programming?

Ans:  This is an alternative approach to identify object with out using object repository. In this approach, the description(identification properties) of the test object, has to provide as a string at the time of test execution. The descriptive programming helps in below use cases –

  • When the test objects are dynamic in nature.
  • When we need to avoid object repository i.e. develop functional scripts through functions.
  • Improve the execution speed.
  • When working with similar types of multiple objects.

Q28. Explain the types of descriptive programming approach?

Ans: Two approaches are available to use descriptive programming –

  • Description Objects – Using the Description object, the the properties can defined and passed during test execution. Example –
Description Object - UFT Interview Questions and Answers
Description Object – UFT Interview Questions and Answers
  • Description Strings – In this approach, the all properties are passed as string during execution. Example –
Browser("MyApp").Page("MyApp").Link("text:=login","type:=Link").Click

Q29. What is the purpose of descriptive programming?

The purposes of descriptive programming are –

  • When the test objects are dynamic in nature.
  • When we need to avoid object repository i.e. develop functional scripts through functions.
  • Improve the execution speed.
  • When working with similar types of multiple objects.

Q30. Explain the differences among descriptive programming and object repository approaches?

Ans:

Object Repository ApproachDescriptive Programming
Objects has to be added in OR.OR is not required.
It is not easy to handle dynamic objects.Dynamic objects can be handled easily.
Reduce the execution performance.Enhance the execution performance.
Need to define the object prior to execution.Objects can be defined during the execution.

Q31. Explain the best practices used for object identification?

Ans: The common best practices are –

  • The logical names in the object repository should be self explanatory of test objects.
  • Disable the smart identification to increase the execution performance.
  • Big object repositories should not be used as it decrease the performance. The descriptive programming is useful in this condition.
  • Use regular expression to handle dynamic objects. Even descriptive programming approach can be used here.
  • Use shared object repository for reusability.
  • Avoid use of duplicate objects in the object repository.

Q32. How to handle dynamic objects in UFT?

Ans: We can use either of the below approach to handle dynamic objects in UFT –

  • Descriptive programming approach – We have already discussed this in previous questions.
  • Regular Expression – UFT allows to define patterns with the use of characters to identify any test objects which follow the same patterns. The series of characters i.e. the patterns can be use by replacing the dynamic part of the test objects. Example – 

By analyzing the link with visible text as – “Business date is 05-12-2021”, we conclude that the “Business date is “ part is static but the remain part is dynamic which will change every day. So, to handle this dynamic object, we can use any of the below patterns while defining the “text” property in the object repository –

Business date is .*” – Here ‘.*’ denotes any string values without any restriction for length.

Business date is \\d\\d-\\d\\d-\\d\\d\\d\\d” – Here ‘\\d’ denotes any numeric digit.

Q33. What is a virtual object? Why did it use?

Ans: The virtual object is used when the test object is not compatible with UFT i.e. object is not getting recognized. The virtual object feature allows to define this kind of objects as link, textbox, button, etc. based on their appearances.

The virtual object wizard can be opened from the UFT menu – “Tools-> Virtual Object->New Virtual Object.” After opening the wizard, the virtual objects can be defined by following the instructions appear in the wizard.

Q34. Explain the approach to create shared object repository from local?

Ans: The conversion approaches are –

  • Export local into shared object repository (File -> Export Local Objects) from the Object Repository window.
  • Drag-drop(cut-paste) the objects from local to shared object repository.

Q35. What is an object Finder? Why is it used?

Ans: This is very helpful while working with objects. The object Finder is used to inspect or analyze the technical properties of test objects at any point of time. Based on the analysis, it will be very easy to plan and design the object recognition methods to create the object repository. Also, it helps to investigate and identify the route cause for object related issues.

For description programming, object Finder is used to capture the technical properties for the test objects.

Q36. What is a regular expression?

  • Ans: UFT allows to define patterns with the use of characters to identify any test objects which follow the same patterns. This patterns are known regular expression. The series of characters i.e. the patterns can be use by replacing the dynamic part of the test objects. Example – 

By analyzing the link with visible text as – “Business date is 05-12-2021”, we conclude that the “Business date is “ part is static but the remain part is dynamic which will change every day. So, to handle this dynamic object, we can use any of the below patterns while defining the “text” property in the object repository –

Business date is .*” – Here ‘.*’ denotes any string values without any restriction for length.

Business date is \\d\\d-\\d\\d-\\d\\d\\d\\d” – Here ‘\\d’ denotes any numeric digit.

Q37. How to get the count of links which are available in a web page?

Ans: We can do this using the below descriptive programming approach with child object–

Sample Code 2 - UFT Interview Questions and Answers
Descriptive Programming – UFT Interview Questions and Answers

Q38. What is ChildObjects?

Ans: This method is used in description programming approach. Based on the description, the method ChildObjects returns a list of matched objects. Please refer last question for example.

Q39. What are ChildItem?

Ans: When working with the table objects, the ChildItem method is used to interact with embed objects with in table cell. It will help to perform operations such as click, getRoProperty, etc. The syntax for usage –

testTableObject.ChildItem(row,col,mic_class,index).Click

testTableObject – Indicates a table object.

row – Indicates table row number.

col – Indicates table column number.

mic_class – Refers type of the embedded object like Link, Button, etc.

index – Refers the occurrence of the embedded object. It always starts from zero.

Q40. How can we associate a shared object repository in action?

Ans: Two options are available –

  • Right-click on the node which represents the action name from the UFT solution explorer section.
  • Choose the option “Associate Repository” with Action to open Shared Object Repository dialog box.
  • Now, choose the correct shared object repository file and click Open to associate it.

Q41. Explain the main difference of “call to copy of action” with respect to “call to existing action”?

Ans: 

call to copy of action  – It will copy the entire reusable action into the working test script as local action. So any change in reusable action will not be reflected here.

Call to existing action  – It will link the reusable action from the working test script as local action. So any change in reusable action will be reflected here.

Q42. What is “Object Repository Manager”?

Ans: It’s use to manipulate shared object repository. It allows to add, modify, remove of test objects from the repository. The object repository manager window can be opened from UFT menu –

Resources -> Object Repository Manager.

Q43. What is the purpose of the “Object Repository Comparision Tool”?

Ans: This tool is used for comparison between two tsr files i.e. shared object repositories. After the comparison, it will identify the mismatches. It can be opened from “Object Repository Manager” by the following path – “Tools->Object repository Comparision Tool.”

Q44. What is the purpose of the “Object Repository Merge Tool”?

Ans: This is used to merge two shared object repository into one. It can be opened from “Object Repository Manager” by the following path – “Tools->Object repository Merge Tool.”

Q45. Explains the action parameters?

Ans: The action parameters are acted as arguments for the UFT action. The main purpose of action parameters is to pass the input values to action and receive the output from the action.

It can be configured from the action properties section. Two types of action parameters can be created which are –

Input Parameter – It’s used to pass input data to the action.

Output Parameter – It’s used to receive output data from the action.

Q46. How to pass data using input action parameters?

Ans: The input action parameters value can be passed through input parameters into the child action. Example –

RunAction “childAction“, oneIteration,ipValu1,ipValu2, opValue

Here, input data are passed through the variables ipValu1 and ipValu2 into the child action. The input parameters are paramValue1 and paramValue2. The input parameters can be read from the child action using expressions Parameter(“paramValu1”) and Parameter(“paramValu2”).

Q47. How can we read the value of output parameters from the main action?

Ans: The output action value can be return through output parameters from the child action. Example –

RunAction “childAction“, oneIteration,ipValu1,ipValu2, opValue

Here opValue is the variable that receives the value of output parameter from the child action.

Q48. How can we click on a link available on a webtable?

Ans: We can click on a link available in a webtable using the childitem method. Example –

Set tableObject = Browser(“SampleApp”).Page(“SampleApp”).WebTable(“MyTable”)

tableObject.ChildItem(row_num,col_num,micClass,index).Click

row_num – row number of the table.

col_num –It represents the column index of the table.

micClass – Object type such as Link, Button, etc.

Index – occurrence of the object type in the particular cell. Index value starts with numeric 0.

Q49. What are the different options are available if a particular object is not getting identified by UFT?

Ans: Different available options are –

  • Use of virtual objects.
  • Perform low-level recording, and we can click on based on the co-ordinates.

Q50. Explain the best practices to work with actions?

Ans: The common best practices are –

  • Give a proper action name.
  • Use action parameters to work with dynamic test data that are generated during execution.
  • Use data table or external excel sheets for test data.
  • Use of shared repository instead of local object repository.
  • Use reusable actions for unit functions.

Q51. What are the functions of UFT? 

Ans: Function is a collection of statements to perform specific task. In UFT, we can write any conditional, logical, looping statements in function through vbscripting. Also, we can write scripts with the help of shared objects repository in functions. Functions are written in function libraries, which are stored in external paths. To work with functions, we need to associate the corresponding functional library with our test scripts.

Using a combination of functions and a shared object repository, we can replace our reusable actions.

Q52. What are the differences between UFT functions and UFT actions?

Ans: The differences are –

  • Action has the own local object repository and datatable. But function does not have that.
  • It is not possible to execute the functions as a standalone component which is possible for UFT actions. The function should be use with in actions.
  • The function is easy to maintain in comparison to actions.
  • By using multiple reusable actions, execution performance may be reduced. Execution performance may be increased by using of function library.
  • We can not develop test scripts without using at least one action. But the function library is not an essential component of UFT. 

Q53. What are the environmental variables? Explain the classifications?

Ans: This features is used for test data parameterization in UFT. The test data which are applicable across the entire test suite, are stored in the environment variables such as, application URL, Report Path, Test Environment name, etc. The structure to use environment variables is Environment.Value(“param_name”). It can be viewed from Environment tab which is available in “Test Settings” wizard.

The environment variables in UFT are classified into below two categories –

Built-in: The built-in environment variables are pre-defined by the UFT which are used to keep the tool and test related information such as, TestName, OS, OS Version, etc. This variables are read-only and can be accessible from entire test suites.

User-Defined: The UFT allows us to create environment variables based on the requirement which are known as user-defined environment variables. Again, two types of user-defined environment variables are available which are –

  • Internal – The scope of this types of variables are specific to the individual test cases only. From the Environment tab of setting wizard, the user-defined internal environment variables can be created, modified or deleted. Also, it can be defined during the execution as well with the expression Environment.Value(“param_name”)=”Some value”.
  • External – This kind of user-defined environment variables are defined in a XML file which need to be attached with UFT to access the individual variables. The external variables can be access through out the suite as read-only.
Environment Variables - UFT Interview Questions and Answers
UFT Interview Questions and Answers

Q54. What are the limitations of virtual objects?

Ans: Limitations are –

  • The virtual objects can not be created through recording.
  • It can not be used with Checkpoints.
  • We can not analyze the virtual objects using object Finder.
  • It’s depends on screen resolution.

Q55. What are the limitations of the function library?

Ans: The limitations of a functional library are –

  • The function library does not have an object repository and datatables.
  • Execution of function is not possible from Function library. It should be referred from Actions to execute.
  • The function libraries are the optional component.
  • It works with shared object repository or descriptive programming to develop functional script through funtions.

Q56. What is datatable? Explain the different types of datatables?

Ans: Datatable is one of the most important components of UFT. It’s similar to Microsoft Excel, which is used to store data and feed the same in test scripts. Based on the data available in different rows of datatable, we can execute the test cases in a loop. Read/ Write both the operations are possible during execution.

The UFT datatables are classified into two types –

  • Local datatable – The every action is built with a default datatable, which is know as local datatable. The scope is available through out the test case. The expressions to access any specific parameter item from the datatable –

DataTable.Value(“paramItem1”,dtLocalSheet) or DataTable.Value(“paramItem1”,”SheetName”)

Here, dtLocalSheet indicates the default local datatable available within the action.

  • Global datatable – The every test case is built with a default datatable, which is know as global datatable. The scope is available through out the test case. The expressions to access any specific parameter item from the global datatable –

DataTable.Value(“paramItem”,dtGlobalSheet) or DataTable.Value(“paramItem”,Global)

Q57. Explain the syntax to read or write data in datatables? 

Ans: In this example, we will see how to copy data from one cell to another cell in UFT datatable.

//Set or select the second row of the datatable
DataTable.GetSheet(“mainAction”).SetRowCount(2)
//Copy from Param1 to Param2 using a temp variable
tempVariable = DataTable.value(“Param1”,“mainAction”)
DataTable.value(“Param2”,“mainAction”) = tempVariable
DataTable - UFT Interview Questions and Answers
DataTable – UFT Interview Questions and Answers

Q58. What is an active screen? Explain the purposes.

Ans: The Active Screen pane allows us to view snapshots of test application as it is displayed during recording time.

We can add steps, checkpoint after running the test by right-clicking in the Active, without opening your application. Also, it can be used as a reference for the test object in the future for any test failure.

Q59. What is the recovery scenario? Explain the purposes.

Ans: A recovery scenario is an approach to control any unexpected events or errors which can appear at the run time. The “Recovery Scenario Manager” wizard is used for working with recovery scenarios. The wizard is available in UFT menu option “Resources → Recovery Scenario Manager.”

Through the recovery scenarios, we can handle either of the below-triggering points, which are the root causes of errors –

  • Errors for un-handled pop-up windows.
  • Errors related to Object State
  • Error during Test Run
  • Application Crash

The main purpose of the recovery scenario is to handle all types of unexpected errors and perform some predefined tasks based on the error types.

Q60. How to develop a recovery scenario?

Ans:  We can define recovery scenarios through the Recovery Scenario Manager through the navigation “Resources → Recovery Scenario Manager.” While developing the recovery scenarios, some configurations need to be done through the Recovery Scenario Manager. The configurations are Triggering Event, Recovery operations, and Post-Recovery Test Run Options.

Q61.Which programming language is followed by UFT for scripting?

Ans: VBScripting is used.

Q62. Write the conditional structure in UFT scripting?

Ans: Different Conditions in UFT are –

If-Else Statements: 

If condition then

               //statements for valid conditions

Else

               //statements for invalid conditions

End If

Switch Statements:

Select Case expression

   Case expression 1

      statement

      ….

   Case expression 2

      statement

      ….   

  Case Else

      writ the else statement

      ….

End Select

Q63. Explain the different types of loop structures available in UFT?

Ans: Different looping structures are –

  • For loop
  • Do While loop
  • While Loop
  • Looping based on entries in datatable by configuring the run settings.

Q64. What are the different kinds of application platforms supported by UFT?

Ans: Major UFT Supported application platforms are – SAP, HTML, Delphi, Powerbuilder, Java, dotNet, Oracle Apps, PeopleSoft, WPF, Webservice, VB, Siebel, Mobile Devices, Terminal Emulator, etc.

Q65. What are the prerequisites required to automate SAP application?

Ans: Prerequisites for SAP automation are –

  • Enable scripting parameters through tcode rz11.
  • Enable scripting from Client option settings.

 Q66. How can we import or export excel in datatables?

Ans: Import Excel sheet:

DataTable.ImportSheet excelFile, sourceSheet, destSheet

excelFile – Represents the excel file which is available in external location.

sourceSheet – Represents the name of the excel sheet which will be imported.

destSheet – Represents the datatable name to store the external excel data.

Export Datatable:

DataTable.ExportSheet excelFile, sourceSheet, destSheet

excelFile – Represents the excel file name which which will be created in external location.

sourceSheet – Represents the name of the datatable which will be exported.

destSheet(Optional) – Represents the external excel sheet name.

Q67. What configuration do we need to create to run the test case in a loop based on the entries in datatable?

Ans: Open the test setting window from the navigation “File->Setting” and select the Run tab. In this section, by selecting either “Run all rows” or “Run from row” radio option, we can enable this looping set.

Q68. How can we connect the database and execute select statements?

Ans: Below steps can be useful to work with database –  

‘Create ADODB connection object

Set objConn = CreateObject(“ADODB.Connection”)

‘Create Recordsetobject

Set objRS = CreateObject(“ADODB.Recordset”)

‘Connect to DB using provider and server

objConn.open <connection string for the database>

‘Define SQL Query

sqlQuery=”Select * from student”

‘Execute SQL

objRS.open “Select studentname from student where role=1”, objConnection

‘Display student name

msgbox objRS.fields.item(0)

‘Close connections

objRecordSet.Close

objConn.Close

Set objConn = Nothing

Set objRecordSet = Nothing

Q69. Explain the different approaches to handle synchronization?

Ans: Synchronization issues can be handled by using the below approaches –

  • Synchronization can be handled using Wait(timeout) statement with the hardcoded wait time in seconds. At this point, the script will wait for a specified duration and then move on to the next step. Based on the application performance, we need to provide the timeout value.
  • WaitProperty – In this approach, we need to provide the property name with values for which execution needs to be a wait and the maximum wait times in mili-seconds. Once the specified property is getting satisfied with expected value, the script execution will proceed with the next step. Example –

Window(“Program Manager”).WinListView(“SysListView32”).WaitProperty “visible”,true,10000

  • Also we can use loop to check the appearance of the object to handle the synchronization.

Q70. How to store UFT test cases in ALM?

Ans: Firstly, we need to connect the ALM from UFT through the Connect ALM option. During the connection, we need to provide the ALM Server, Credential, and project details to connect. After the successful full connection, we need to choose the ALM path while saving the test scripts.

Q71. How can we execute UFT test cases from ALM?

Ans: Goto the ALM Test Lab and select the corresponding test cases from the Test Set. By clicking on the Run button to initiate the execution. We can trigger the execution for multiple or entire testset at a time. After initiation, ALM will invoke the UFT in the background and start the execution based on the  selection.

Run From ALM
Run From ALM

Q72. What setting is available to enable remote execution in UFT?

Ans: Open the Options window from navigation “Tools->Options.” In the General tab, we need to select the Run Sessions section to enable a remote execution setting.

Here we need to set the check box and provide valid credentials of the remote test systems.

Remote Execution Setting
Remote Execution Setting

Few more important UFT Interview Questions and Answers:

Q73. Explain the merits of UFT over Selenium?

Ans: The merits of UFT over Selenium are mentioned below –

· Selenium only supports web applications where UFT supports different platforms such as web, SAP, Windows, Mobile, etc.

· Easy to develop/ maintain test scripts in UFT over Selenium.

· Easy to learn UFT in a shorter span of time.

· End-to-end testing is possible in UFT.

· We can test different application interfaces through web services which is not possible in Selenium.

· UFT saves the costs and efforts, mostly in regression testing over Selenium.

· Easy to embed UFT with ALM for test management. The integration between Selenium and ALM is very difficult.

· Test framework setup is easy for UFT.

Q74. How to invoke web browser in UFT?

Ans: Different ways to invoke web applications are –

·         Using SystemUtil.Run method – The structure of the statements is SystemUtil.Run ( Name_of_File, Arguments, File_Path, action)

· Use of VBScripting Wscript.shell class – 

Dim oShellSet oShell = CreateObject (“Wscript.shell”)

           oShell.run “<Path for browser>”

           Set oShell = Nothing

·  Use of object InternetExplorer.Application – 

            Set obj = CreateObject(“InternetExplorer.Application”)

obj.Navigate https://www.google.com/

            obj.Visible = True

            obj oIE = Nothing

Q75. Explain the approach of the automation recording option?

Ans: It is an approach to generate linear test cases by recording the manual navigation through the UFT. During the recording, the raw test cases are created where data are hardcoded with zero script reusability. It’s useful for one time test execution. It’s not advisable to create the test case for longer run through the recording feature of UFT.

The recording can be initiated by pressing F6 key or clicking on Record button which is available in Record Tab.

Q76. Explain the steps of script debugging?

Ans: Debugging is an approach to identify the script issues through a dummy run. The steps are –

· Create the breakpoint by pressing after the selection of a particular script line from where we need to start the debugging.

· Run the test or start debugging from the first step (Run->Debug from step). Here in the first case, execution will be halted at the breakpoint.

· Now we can debug each code of line by pressing F10(Step Over) or F11(Step into) key. F10 will debug each line in the parent function, but through F11, we can drill down into the sub-functions.

· During the debugging, we can view any variable or state of objects by pressing the “Ctrl+Alt” keys together.

Q77. How to log verification status in UFT reports?

Ans: We can log the verification status using the ReportEvent method. The structure of this method is –

Reporter.ReportEvent status, step_name, details, image_file_name

status – four options are available based on the verification result. micPass, micFail, micWarning, micDone.

step_name – need to provide the actual step name or the expected result.

details – need to provide the actual result.

image_file_name – This is an optional step to provide the screenshot filepath.

Q78. Explain the different types of recording modes in UFT?

Ans: Different recording modes in UFT are mentioned below,

·       Normal mode – The normal mode is the default recording mode available in UFT which uses all the features to identify the test objects. The normal mode is also referred as Contextual, which is applicable only for UFT compatible applications.

·        Low-level recording mode – The low-level recording mode is applicable for applications which are not identified by the UFT. In this mode, scenario is getting recorded based on the co-ordinates of the test objects.

· Analog Recording – Analog recording mode records the movement of mouse and keyboard actions..

Q79. Explain the concepts of a logical name for any object?

Ans: Logical name is defined by the UFT while adding or recording to map any object with the application name. It can be modified based on user object behavior. 

Q80. Specify the extension of UFT script?

Ans: The UFT scripts are created with .mts extension.

Conclusion:

Expecting this UFT interview questions and answers will definitely help to clear the UFT interviews.

 We wish you all success!!