Common UFT (QTP) Interview Questions for 2023 - IQCode
What is Unified Functional Testing (UFT)?
Unified Functional Testing (UFT), previously known as QuickTest Professional (QTP), is a software tool used for automating functional and regression testing in software applications and environments. UFT provides a graphical user interface as well as keyword and scripting interfaces. The tool specifies a test procedure and manipulates the objects and controls of the application under test using the Visual Basic Scripting Edition (VBScript) language. With UFT, developers can test the interface, service layer, and database layer of a program's operations all from a single console.
UFT is an automated functional testing tool used by testers to run automated tests that identify any flaws, defects, or gaps in the application under test's expected outcomes. Originally created by Mercury Interactive, QTP was eventually acquired by HP and is now MicroFocus.
To design, develop, and manage tests, UFT relies heavily on a tester's programming expertise. However, simply knowing the tool or VB Script's features is not enough. The ability to develop logic is the most crucial skill an automation tester should possess. UFT and VB Script serve as tools that assist in finding a solution but are not the solution themselves.
UFT stands out in its execution of test information, test execution reports, and article repositories. Knowledge of UFT would likely provide an advantage in finding a job in software testing.
Here are some commonly asked interview questions on UFT:
UFT Interview Questions for Freshers
1. What are the advantages of using UFT as an automation tool for testing?
Features of UFT
UFT (Unified Functional Testing) is a testing tool for automating functional and regression testing. Below are some of its features:
- Supports multiple technologies and platforms such as web, mobile, desktop, and mainframe applications.
- Provides a user-friendly IDE (Integrated Development Environment) for test creation and execution.
- Allows both keyword-driven and script-based testing approaches.
- Enables object identification using Smart Object Recognition, Regular Expressions, and Insight Object Recognition.
- Includes a built-in Test Results viewer for easy analysis of test results.
- Allows integration with other testing tools such as ALM (Application Lifecycle Management), Jenkins, and Git.
Understanding Checkpoints in UFT
In the context of UFT (Unified Functional Testing), checkpoints are used to verify the expected results of an application during runtime. It helps to identify and address any deviations from the expected results and ensures the application’s quality.
Following are the different types of checkpoints available in UFT:
- Standard Checkpoint: It compares the expected and actual values of an object’s properties and provides the final result in the test results.
- Table Checkpoint: It checks the content of a table by comparing it with the expected values in the database and generates a report with the results.
- Text Checkpoint: It examines the text displayed in an application and compares it to the expected text. It also allows the user to set tolerances for spelling mistakes, extra spaces, and other errors.
- Accessibility Checkpoint: It checks the accessibility of an application and confirms whether it is compliant with the accessibility standards, like Section 508.
- Database Checkpoint: It verifies the expected data in the database and validates it with the actual database content.
- XML Checkpoint: It checks the validity of XML documents by verifying syntax, hierarchical structure, and attribute values.
- Bitmap Checkpoint: It compares the actual and expected images of an application, which helps to identify if there are any image quality issues.
Using checkpoints appropriately is critical in ensuring the reliability and functionality of an application, which helps businesses provide a seamless user experience to their customers.
Understanding Descriptive Programming in UFT
Descriptive Programming is a technique used in UFT (Unified Functional Testing) to identify objects in the application under test without using the object repository. This means that instead of mapping the objects to the repository, we can refer to them directly in our code.
There are two types of Descriptive Programming:
1. Static Syntax: In this type, we define all the properties of the object in our code. This is useful when the object properties are unlikely to change.
2. Dynamic Syntax: In this type, we use regular expressions and property values that may change at runtime. This is useful when the object properties are dynamic and may change frequently.
Descriptive Programming is very useful when working with dynamic applications, where the objects are constantly changing, or when working in a shared environment where multiple testers are collaborating on a project. It also provides greater control and flexibility in test automation.
Understanding Actions in UFT and Importing Them into a Test
Actions in UFT refer to a set of steps or operations performed on an application or software under test. They provide a modular approach to test design and execution by breaking down a complex test scenario into smaller, manageable units.
To import an action into a test in UFT, you can follow these steps:
- Open the test in which you want to use the action.
- Click "Insert" from the menu bar and select "Call to Existing Action" or simply click the "Call to Existing Action" button on the toolbar.
- Locate the folder and test containing the action you want to import and select it.
- Select the action you want to import and click the "OK" button.
- Customize the parameters of the action if necessary.
- Save the test to preserve the changes.
By importing actions into a test, you can reuse the same set of operations in multiple tests, save time, improve test maintenance, and make your testing process more efficient.
How to Run Multiple QTP Scripts Simultaneously
To run multiple QTP scripts simultaneously, you can use the "ParallelRunner" utility provided by the QTP itself. This utility enables you to execute multiple QTP scripts on different machines or processors in parallel.
To use the "ParallelRunner" utility, follow the below steps:
- Create a batch file with the list of the QTP scripts that you want to run simultaneously.
- In the batch file, call the ParallelRunner utility with parameters such as the path of QTP.exe, the test type, the test path, the required results path, etc.
- Save and execute the batch file from the command prompt.
By following these steps, you can effectively run multiple QTP scripts simultaneously, saving you time and effort.
Understanding Data Tables in UFT
In UFT, data tables are used to store and manipulate test data. Test data is an integral part of test automation as it drives the test execution and ensures maximum test coverage. There are two types of data tables in UFT:
1. Global Data Table - This data table is used to store data that will be used across multiple test scripts in the same test or even across multiple tests.
2. Action Data Table - This data table is used to store data only for the specific test action or component being executed.
Some of the commonly used Data Table object methods are:
1. AddSheet - This method is used to add a new sheet to the existing data table.
2. GetRowCount - This method is used to retrieve the total number of rows containing data in a specific sheet.
3. GetParameter - This method is used to retrieve the value of a parameter in a specific cell.
4. SetParameter - This method is used to set the value of a parameter in a specific cell.
Using data tables in UFT enables testers to make their test automation scripts more dynamic and efficient, thereby reducing the need for manual intervention.
Understanding GetROProperty, SetTOProperty, and GetTOProperty in UFT
In UFT (Unified Functional Testing), GetROProperty, SetTOProperty, and GetTOProperty are three important methods that can be used to manipulate object properties.
GetROProperty is a method that retrieves the current value of a specified property from a test object at runtime. This method is useful when you want to verify or compare the value of an object's property with an expected value.
SetTOProperty, on the other hand, is used to set the value of a specified property for a test object in the object repository. This method is useful when you want to modify the properties of an object that are used during the test run.
GetTOProperty retrieves the value of a specified property for a test object stored in the object repository. This method is useful when you want to obtain a property value of a test object during the script run time.
Defining and using these methods appropriately can greatly enhance the efficiency and accuracy of UFT scripts.
Explanation of QTP Local Repository's Extension and the .MTR Extension
QTP (QuickTest Professional) is a tool used for testing software applications, and it has a local repository where it stores objects related to the application being tested. The extension for the QTP local repository is .mtr. The .mtr extension stands for "Mercury Test Results." It is a binary file format created by QTP to store test results, including run parameters, log details, and report formats.
// No code to provide for this prompt as it is an explanation prompt
How to Close the Second Browser Opened with UFT?
To close the second browser that has been opened using UFT, you can use the following code:
' Get the number of open browser windows numOfBrowsers = Browser("micclass:=Browser").Count ' Check if there are at least two browsers open If numOfBrowsers >= 2 Then ' Close the second browser Browser("Index:=1").Close Else ' Display message if there are not two open browsers MsgBox "There are not at least two open browsers." End If
This code checks the number of open browser windows and closes the second browser window if there are at least two open. If there are not at least two open browsers, a message box will be displayed.
Understanding Synchronization Points in UFT
In the context of UFT, a synchronization point is a point in the test script where the tool waits for a certain condition to be met before proceeding with the next steps. This helps ensure that the test operates at the right speed and that the application under test functions as expected.
Different ways to insert synchronization points in UFT include: - Adding wait time: This involves using the wait command to pause the test script for a specified amount of time. - Using checkpoints: This involves the use of checkpoints to verify the expected state or value of an object in the application before proceeding with the test. - Using conditional statements: This involves using if-else and loop statements to check for certain conditions before proceeding with the test. - Synchronization methods: This includes using built-in synchronization methods provided by UFT, such as WaitProperty and Exist. These methods help ensure that the application state is stable before proceeding with the test.
By incorporating synchronization points in a test script, testers can improve test performance, minimize test failures, and improve the quality of the application under test.
Possible Types of Errors in UFT
In UFT, there are various types of errors that one can encounter while scripting or executing automated tests:
These errors occur when the UFT script contains incorrect syntax or grammar, which can cause the test to fail to execute.
These errors occur when an unexpected condition is encountered during script execution, causing the test to fail.
Object identification errors:
These errors occur when UFT is unable to identify objects on the application being tested, which can cause the test to fail.
These errors occur when there are issues with the testing environment or configuration that can impact the test's ability to execute or obtain accurate results.
It is essential to be aware of these types of errors to effectively debug and troubleshoot the automated tests in UFT.
Feasibility of Running Two UFT Instances on Same Workstation
In general, it is feasible to run two Unified Functional Testing (UFT) instances on the same workstation. However, this may depend on several factors including but not limited to the capacity and resources of the workstation, the size and complexity of the UFT test cases being executed, and the licensing agreement with the UFT software provider. It is recommended to consult with the relevant stakeholders to determine if running two instances of UFT is feasible for a specific environment.
If the workstation has limited resources or the UFT test cases are large and complex, running two instances may not be optimal and performance issues may arise. Additionally, if the licensing agreement with the UFT software provider does not allow for multiple instances on the same workstation, it would not be feasible to run two instances.
Understanding Output Values in UFT
In UFT, output values refer to the captured values of a specific property or object during runtime that can be used later in the test for verification, data driving, or any other purpose.
There are mainly two types of output values present in UFT:
- Standard Output Values - used to capture a variety of properties of an object, such as text, value, or index.
- Custom Output Values - used to capture properties that are not accessible through standard output values.
UFT Interview Questions for Experienced:
In UFT, there are three different types of recording modes available:
1. **Normal recording mode** - records all the objects and their properties that are accessed during the test.
2. **Low-level recording mode** - records the exact co-ordinates of the mouse pointer, keyboard strokes, and other low-level interactions with the application's user interface.
3. **Analog recording mode** - records the flow of user actions and keyboard/mouse input using a graphic overlay.
Yes, it is possible to change between recording modes while creating a test by going to the "Record" menu and selecting the desired recording mode. It is important to choose the recording mode that best fits the test scenario in order to achieve the most accurate and reliable test results.
Understanding Object Repositories in UFT and Object Identification Process
In the context of UFT, an Object Repository is a collection of all the objects in an application that UFT has identified or "learned". These objects include web elements, buttons, text boxes, check boxes, etc. Object Repositories serve as a central location where UFT stores information about the objects, such as their properties and values, so that UFT can easily identify and interact with these objects during test execution.
Object identification in UFT works by identifying the unique properties of an object and storing it in the Object Repository. During a test run, UFT uses these properties to locate and interact with the object. UFT employs several techniques for object identification including Smart Identification, Regular Expressions, and Ordinal Identifiers.
Smart Identification is UFT's built-in feature that automatically applies a set of fallback rules if UFT is unable to locate an object using the properties specified in the Object Repository. Regular Expressions enable testers to use a flexible pattern matching syntax to identify dynamic objects with varying property values. Ordinal Identifiers allow UFT to interact with objects based on their position within the application's layout.
In conclusion, Object Repositories and Object Identification are essential components of UFT's automated testing process as they enable testers to identify and interact with objects in an application accurately.
The Different Types of Object Repositories Available in UFT
In UFT, there are two types of object repositories available:
- Local Object Repository
- Shared Object Repository
Local Object Repository: This type of object repository is associated with a specific test and is saved as a separate file. It can only be accessed by the test with which it is associated.
Shared Object Repository: This type of object repository can be accessed by multiple tests and is saved as a separate file. It contains objects that are shared across multiple tests and allows for easy maintenance of objects. It can also be locked for editing to prevent multiple users from making changes simultaneously.
Differences between UFT and Selenium
UFT (Unified Functional Testing) and Selenium are both widely used automation testing tools, but there are some key differences between them. Here are some of the main differences:
- Cost: UFT is a commercial tool and requires a license to use. Selenium, on the other hand, is open-source and free to use.
- Supported languages: UFT supports multiple programming languages such as VBScript, C#, and Java, whereas Selenium supports several languages including Java, Python, Ruby, and C#.
- Integration: UFT is tightly integrated with other tools in the HP ecosystem, while Selenium integrates with a variety of tools in the open-source community.
- Object Repository: UFT uses a centralized Object Repository for storing test object information, while Selenium requires developers to manually define test objects in their code.
- Compatibility: UFT supports a wider range of platforms and technologies, including desktop, web, and mobile applications. Selenium focuses primarily on web-based testing but can be extended for mobile testing as well.
Overall, both UFT and Selenium have their strengths and weaknesses. The choice between them depends on the specific testing requirements, available resources, and team preferences.
Code snippets and examples omitted for brevity.
Understanding Virtual Objects in UFT and their Limitations
In UFT, virtual objects are test objects that do not have a physical representation on the screen. They are created to identify and interact with non-standard objects such as custom controls or objects in remote environments.
Virtual objects have some limitations in UFT. Firstly, they are not as reliable as standard test objects, as they may not match the actual properties or behavior of the object they represent. Secondly, virtual objects can be less efficient than standard test objects and may impact test performance. Lastly, troubleshooting issues with virtual objects can be more difficult as they require additional configuration and maintenance.
It is important to use virtual objects judiciously and only when necessary in order to maintain the accuracy and efficiency of UFT tests.
Understanding Expert View and Keyword View in UFT
In UFT (Unified Functional Testing), Expert View and Keyword View are two different ways to view and edit test scripts.
On the other hand, Keyword View displays the test script in a keyword-driven table format, where users can create and modify automated tests by using pre-defined keywords and their arguments. This view is more user-friendly, allowing testers with little or no programming experience to create tests easily.
In summary, Expert View is geared towards experienced testers who prefer to directly work with code, while Keyword View is designed for beginners or non-technical testers who prefer a simpler, more visual approach to test automation.
Methods for Launching an Application in UFT
In UFT (Unified Functional Testing), you can launch an application using different methods, including:
1. SystemUtil.Run 2. CreateObject 3. InvokeApplication 4. DESKTOP.RunApplication 5. .NET Environment Methods
Each method has unique functionality for launching an application. It is advised to choose the most suitable method based on the application type and testing requirements.
Understanding Object Spy in UFT
In the context of UFT (Unified Functional Testing), Object Spy is a tool that allows users to explore and examine the properties of objects within an application or webpage. It is a powerful feature that helps testers identify and select the correct objects for their automation scripts. When the Object Spy is opened, users can hover their cursor over various objects and the tool will display information about them, such as their object type, name, properties, and methods. This enables testers to better understand the object hierarchy and make informed decisions about how to interact with the objects during their testing process.
Possible Reasons for Script Failure When Executed from QC
There could be several reasons why a script that was saved in QC failed to run when executed from within QC. Some of the possible reasons are:
- The script was not properly synchronized with QC
- QC does not have the necessary permissions to run the script
- There is a syntax error in the script
- The script is not compatible with the version of QC being used
- There is a resource conflict preventing the script from running
It is recommended to check these potential issues and troubleshoot them accordingly to successfully execute the script from QC.
// Example of troubleshooting if there's a syntax error
var num = 5;
console.log("The number is " + num);
// Should output "The number is 5" to the console