Software Training Institute in Chennai with 100% Placements – SLA Institute

Easy way to IT Job

Share on your Social Media

QTP Tutorial for Beginners

Published On: August 11, 2025

QTP Tutorial for Beginners

Ever wondered how software firms ensure their apps run seamlessly every time, without manually clicking through hundreds of steps? The answer usually lies in test automation, and one of the greatest tools in this field is QTP, officially known as Micro Focus UFT One (Unified Functional Testing). This complete QTP tutorial for beginners is your friendly gateway to mastering QTP/UFT One.

Ready to learn more and become a QTP/UFT One master? Check out our in-depth QTP Course Syllabus to find out what else you can study!

What is QTP/UFT One?

UFT One or QTP is an automated functional testing application that assists you in verifying whether your software program is doing its job. It is like a very effective helper who can tirelessly reproduce test steps repeatedly, much quicker and more precisely than any human.

From QTP to UFT One: Initially named QuickTest Professional (QTP), it was created by Mercury Interactive, followed by being acquired by HP and subsequently Micro Focus. It is now known as UFT One and is owned by OpenText. The name was changed to “Unified Functional Testing” since it offers a comprehensive testing solution by combining the advantages of both GUI (Graphical User Interface) and API (Application Programming Interface) testing.

Purpose: Its primary function is to perform functional and regression tests. This indicates that you are able to script user actions (such as clicking buttons, entering text, or navigating pages) and then repeat these scripts again and again to test if new changes have not destroyed previously working functionalities (regression testing).

Why Should You Learn QTP/UFT One?

Manual testing isn’t enough in today’s quick-paced world of software development. Enter QTP/UFT One. Learning this product has a lot of advantages:

  • Increases Efficiency: UFT One does these tedious tasks automatically, freeing up an enormous amount of time and effort. This translates to quicker feedback loops and faster releases.
  • Increases Accuracy: QTP runs tests exactly the same each time, minimizing the possibility of human mistake and delivering consistent results.
  • Expanded Test Coverage: With automation, you can execute more tests faster, letting you test more features and edge cases that could get overlooked during manual testing.
  • Cost-Effective in the Long Run: Although there is an investment in initial learning and configuration of UFT One, the long-term gains from lower manual effort and quicker bug detection are considerable.
  • Supports Multiple Technologies: Whether you’re automating a web application, a desktop application developed on Java or .NET, an SAP environment, or even mobile applications, QTP has you covered.
  • Beginner-Friendly (with GUI): As opposed to some other automation tools that are strictly code-intensive, UFT One provides a friendly Graphical User Interface (GUI) with capabilities such as record and playback, making it simpler for beginners to pick up.
  • Industry Demand: Most businesses depend on UFT One to automate their tests, so it’s a must-have skill for any future QA professional.

Recommended: Software Testing Course Online.

Key Features of QTP/UFT One: Your Automation Superpowers

QTP is loaded with features that make test automation a piece of cake. Let’s examine some of the most critical ones:

  • Object Recognition: QTP identifies objects (such as buttons, text boxes, links) on your application by their distinguishing characteristics (e.g., id, name, class).
    • Smart Identification: A smart feature that assists UFT One in identifying objects even when some of their characteristics change at runtime.
  • Object Repository: Consider this as a master database where UFT One keeps data about all the objects it has to handle in your application.
    • Local Object Repository: Customized to a specific action of a test.
    • Shared Object Repository: Shared across multiple tests, promoting easier maintenance and reusability.
  • Recording and Playback: Here is where you can make simple test scripts in no time without writing even one line of code! UFT One captures your operations on the application and automatically creates VBScript code. Then you can “play back” those recorded steps to run the test.
  • Checkpoints: These are validation points in your test script that ensure whether the application is responding as anticipated. You can put checkpoints into place to:
    • Validate text content (e.g., “Is the welcome message being shown properly?”).
    • Validate the presence of an object.
    • Compare images.
    • Validate table data.
    • And many more!
  • Parameterization (Data-Driven Testing): Rather than having to write individual tests for every data set, you can parameterize your single test script to pass varying input values (from an Excel sheet or UFT’s inherent Data Table) into it. 
  • VBScript Support: Record and playback may lead you to a point, but VBScript knowledge enables you to incorporate sophisticated logic, address dynamic situations, and create strong automation frameworks.
  • Actions: In UFT One, a “test” consists of one or more “actions.” Actions are similar to modular units of code that do particular tasks.
    • Reusable Actions: Can be called and reused in several tests.
    • Non-Reusable Actions: Dedicated to a specific test.
  • Synchronization Points: Synchronization points instruct UFT One to wait until a certain object or for a specific amount of time before continuing to the next step, to avoid your script crashing because of timing.
  • Reporting: Upon completion of testing, UFT One produces extensive reports, indicating which steps passed, which failed, and why. These reports tend to have screenshots of failed steps, simplifying debugging.

Getting Started with QTP/UFT One: First Steps!

Time to get your hands dirty! Here’s a brief summary of how you’d normally begin with UFT One:

  • Installation: As it’s a commercial product, you’ll require a license or a trial copy. The install is quite simple, usually downloading the installer and following the instructions on-screen. Ensure your system has the minimum requirements!
  • Add-in Manager: It appears when you start QTP. Here you choose the technologies used by your application under test (AUT) (e.g., Web, .NET, Java, SAP). 
  • The UFT One Interface: Become familiar with the main components of the UFT One window:
    • Keyword View: An easy-to-use, table-based view of your test steps. Excellent for beginners.
    • Expert View: Where you view the actual VBScript code created by UFT One or where you compose your own code. It provides more control.
    • Object Repository Pane: Where you store your test objects.
    • Data Table Pane: Used for data-driven testing.
    • Output Pane: Shows results, errors, and messages while running tests.
    • Solution Explorer: Keeps your test assets (actions, function libraries, object repositories) organized.

Explore: Software Testing Course Tutorial for Beginners.

Your First Automated Test: Record and Playback

This is the simplest way to get started with test automation using UFT One. It’s almost teaching UFT One what to do!

Scenario: We want to test a basic login process on a demo site.

Steps:
  • Open QTP and choose the “Web” add-in.
  • Create a New GUI Test: File > New > Test. Select “GUI Test.
  • Set Record and Run Settings: UFT One must be aware of which application it will be working on prior to recording.
    • Navigate to Automation > Record and Run Settings.
    • Under the Web tab, choose “Record and run test on any open browser” or “Record and run test on a specified URL” and type in your demo website’s login page URL.
  • Start Recording: Press the Record button (or use F3). The Record toolbar appears when UFT One opens the browser.
  • Perform Actions: Manually carry out the login actions on your demo website:
    • Type a username in the username field.
    • Type a password in the password field.
    • Press the “Login” button.
  • Stop Recording: Press the Stop button on the Record toolbar after the steps are complete.
  • Review the Script: UFT One will produce a VBScript. You’ll notice steps such as:

Browser(“Login Page”).Page(“Login”).WebEdit(“username”).Set “your_username”

Browser(“Login Page”).Page(“Login”).WebEdit(“password”).Set “your_password”

Browser(“Login Page”).Page(“Login”).WebButton(“Login”).Click

  • Casual Technical Word: Pay attention to how UFT One “spies” out each item and gives it a logical name (e.g., WebEdit(“username”)). This is how UFT One memorizes what that particular text box is.
  • Play Back the Test: Click the Run button (or use F5). UFT One will run the recorded steps, simulating your actions.
  • Analyze Results: Once executed, the Run Results Viewer will appear, indicating to you whether your test succeeded or failed.

Suggested: Manual Testing Tutorial for Beginners.

The Heart of Automation: Object Repository Explained

The Object Repository (OR) is where UFT One retains the properties of all the objects (such as buttons, text boxes, links, images) that your test acts upon. It’s important because UFT One employs these details in order to find and interact with these objects at runtime.

  • How it Works: When you record a test or input objects manually with the Object Spy, UFT One records a collection of distinctive properties for each object. For instance, a “Login” button could have properties such as text=”Login”, html tag=”INPUT”, type=”submit”.
  • Why it’s Important:
    • Secure Identification: If the position of an object on the screen changes, UFT One will still be able to identify it based on its properties in the OR.
    • Reusability: You can reuse objects between different tests or actions, resulting in time and effort saving.
    • Maintainability: If a property of an object changes (e.g., a button’s label changes from “Submit” to “Send”), you need to change it in just one location (the OR) rather than every test script where it’s referenced.
  • Types of Object Repositories:
    • Local Object Repository: This is the default. Each action in your test includes a local OR.
    • Shared Object Repository (.tsr file): For larger projects, it’s highly recommended to use a shared OR. All tests and actions can refer to objects in this central file. This is crucial for building robust test automation frameworks.

Using the Object Spy:

The Object Spy is your best friend for understanding how UFT One sees your application’s elements.

  • Click the Object Spy button on the toolbar (or press F12).
  • Place your mouse over any object within your application. Its properties and methods will be shown by the Object Spy.
  • You can even place objects directly into your Object Repository through the Object Spy.

Explore: VB Dot Net Course Online.

VBScript Basics for QTP/UFT One: Adding Logic

While record and playback is perfect for simple flows, applications in the real world demand more advanced testing. That’s where VBScript steps in. UFT One employs VBScript to enable you to include your own logic, deal with dynamic situations, and create robust test scripts. Relax, it’s a fairly simple language to learn!

Key VBScript Concepts for UFT One:

Variables: They are used to save data.

Dim userName

userName = “tester123”

Browser(“Login Page”).Page(“Login”).WebEdit(“username”).Set userName

Data Types: VBScript has one data type, Variant, which can store various types of information (numbers, strings, booleans).

Operators: Used for calculations (arithmetic), comparisons (e.g., =, >, <), and logical operations (AND, OR, NOT).

Conditional Statements (If.Then.Else): To run different code blocks under different conditions.

If Browser(“Login Page”).Page(“Login”).WebButton(“Login”).Exist(10) Then

    Reporter.ReportEvent micPass, “Login Button”, “Login button exists on the page.”

Else

    Reporter.ReportEvent micFail, “Login Button”, “Login button NOT found!”

End If

Loops (For.Next, Do.Loop, While.Wend): To run a block of code more than once. Extremely useful for data-driven testing.

‘ Example: Looping through a Data Table

For i = 1 To DataTable.GetRowCount

    DataTable.SetCurrentRow(i)

    userName = DataTable(“Username”, dtGlobalSheet)

    password = DataTable(“Password”, dtGlobalSheet)

    Browser(“Login Page”).Page(“Login”).WebEdit(“username”).Set userName

    Browser(“Login Page”).Page(“Login”).WebEdit(“password”).Set password

    Browser(“Login Page”).Page(“Login”).WebButton(“Login”).Click

    ‘ Add verification steps here

Next

Functions and Subroutines: To encapsulate your code as reusable blocks.

‘ Subroutine to perform login

Sub PerformLogin(username, password)

    Browser(“Login Page”).Page(“Login”).WebEdit(“username”).Set username

    Browser(“Login Page”).Page(“Login”).WebEdit(“password”).Set password

    Browser(“Login Page”).Page(“Login”).WebButton(“Login”).Click

End Sub

‘ Calling the subroutine

PerformLogin “testuser”, “testpass”

Error Handling (On Error Resume Next): Used to handle surprise errors during script run time in a graceful manner.

On Error Resume Next ‘ Continue script execution even if an error occurs

Browser(“Login Page”).Page(“Login”).WebEdit(“nonexistent_element”).Set “Some Text”

If Err.Number <> 0 Then

    Reporter.ReportEvent micWarning, “Error Handling”, “Error occurred: ” & Err.Description

    Err.Clear ‘ Clear the error

End If

On Error GoTo 0 ‘ Turn off error handling

Reporter.ReportEvent: A very useful UFT One function to report custom messages and status (Pass, Fail, Done, Warning) into the test outcome. It is crucial to provide transparent reporting.

Explore: Selenium Online Course for Beginners.

Advanced QTP Concepts

These more complex ideas will improve your automation abilities once you’ve mastered the fundamentals.

Data-Driven Testing (DDT):

QTP’s Data Table (which is essentially an Excel-like spreadsheet within UFT) is your go-to for DDT. You can define multiple rows of test data, and UFT One will iterate through them, running the same test script with different inputs.

Checkpoints: The Verifiers:

  • Regular Checkpoints: Check for simple object properties (e.g., text, enabled state).
  • Text Checkpoints: Check if particular text appears on the screen.
  • Text Area Checkpoints: Check text in a specific area.
  • Bitmap Checkpoints: Compare images pixel for pixel (suitable for visual changes).
  • Database Checkpoints: Check data within a database.
  • XML Checkpoints: Check XML data.
  • Page/Frame Checkpoints: Check properties of a frame or web page.
  • Table Checkpoints: Check content of a table.

Output Values: 

Contrast to parameterization, output values enable you to pull data from your application while running a test and save it. This pulled data can be utilized in subsequent steps of the same test or even in other tests. For instance, capturing an order ID after a successful purchase.

Reusable Actions and Calling Actions:

  • Simplify difficult tests into smaller, manageable, and reusable actions.
  • You can “call” one action from another, building a modular and structured test system. This is a fundamental principle of effective test framework design.

Descriptive Programming: 

Sometimes an object may not be present in your Object Repository, or its attributes are dynamic and may change every now and then. Descriptive programming lets you recognize objects directly in your VBScript code based on their properties, without using the OR.

‘ Example: Clicking a button using descriptive programming

Browser(“title:=.*Google.*”).Page(“title:=.*Google.*”).WebButton(“name:=btnK”, “type:=submit”).Click

Synchronization Techniques: 

Beyond Wait statements, UFT One has the following:

  • Exist(): Verifies if an object exists within a time limit.
  • Sync: For web objects, waits for the browser page to be loaded completely.
  • WaitProperty: Awaits a particular property of an object to attain a specific value.

Recovery Scenarios

What if an unexpected pop-up occurs, or an error message stops your test? Recovery Scenarios enable UFT One to automatically recover from such unexpected scenarios without your tests failing. You can specify triggers (e.g., an error message being displayed), recovery actions (e.g., clicking “OK”), and post-recovery steps.

Explore: Software Testing Salary in India.

Best Practices for UFT One Automation: Work Smart, Not Hard

To create healthy and sustainable automation scripts, implement these best practices:

  • Plan First and Then Automate: Avoid diving headfirst into recording. Plan your test cases, isolate reusable pieces, and define your automation plan.
  • Modularize Tests: Split large tests into smaller, reasonable steps. This increases reusability and facilitates debugging.
  • Utilize Shared Object Repositories: For large projects, this is not optional. It centralizes object management and significantly lowers maintenance work.
  • Leverage Parameterization: Design your tests data-driven from the beginning. This makes them reusable and minimizes the number of scripts you require.
  • Insert Checkpoints Strategically: Check significant states and outputs at crucial areas in your test flow. 
  • Implement Error Handling: Employ On Error Resume Next and Err object to handle unexpected errors elegantly.
  • Add Comments Liberally: Comment your code! It makes it easier for others (and yourself later on) to comprehend what your script is doing.
  • Use Descriptive Programming When Necessary: For dynamic objects or objects outside of the OR, descriptive programming is a compelling choice. 
  • Review and Refactor Regularly: As with application code, automation scripts must be reviewed and refined periodically. Eliminate unnecessary code, streamline steps.
  • Keep Your Object Repository Clean and Current: Get rid of unused objects and modify properties when the application is altered.
  • Avoid Hardcoding: Avoid putting fixed values directly into your script. Use variables, parameters, or configuration files.
  • Good Reporting: Take advantage of Reporter.ReportEvent to include meaningful messages in your test output.

Explore: Software Testing and Quality Assurance Job Seeker Program.

Troubleshooting Common QTP/UFT One Issues: When Things Go Wrong

Even the most skilled automation engineers encounter problems. Below are some typical issues and how to solve them:

Object Not Found Error: This is likely the most frequent.
  • Cause: The properties of the object have been altered in the application, or UFT One is unable to identify it.
  • Solution: Reprobe the object using the Object Spy and redefine its properties within the Object Repository. Use Smart Identification or Descriptive Programming.
Synchronization Issues: Test is failing due to the fact that the application has not finished loading.
  • Cause: UFT One attempts to access an object before it’s visible or enabled.
  • Solution: Add WaitProperty statements, Exist() checks, or Browser().Page().Sync following page loads or significant actions.
Run-time Errors (VBScript Errors):
  • Cause: Errors in your VBScript code (syntax errors, logic errors, undefined variables).
  • Solution: Debug your code line by line using UFT One’s debugger (F11 for Step Into, F10 for Step Over, breakpoints with F9) and find the error. The Output pane usually includes useful error messages.
Add-in Missing: UFT Cannot identify objects from a particular technology.
  • Cause: The needed add-in (e.g., SAP, Java) was not chosen in the Add-in Manager when starting UFT One.
  • Solution: Shut down UFT One, restart it, and choose the required add-ins.
Performance Issues (Slow Execution):
  • Cause: Excessive unnecessary add-ins loaded, excessive logging, frequent screenshots, or poor script logic.
  • Solution: Remove unused add-ins, improve your VBScript code, limit taking screenshots to failures only, and don’t wait uselessly.
Data Table Problems: Data is not read or written properly.
  • Cause: Wrong column names, wrong sheet chosen, or data type problems.
  • Solution: Check column names used in DataTable() calls, double-check you are using the right sheet (dtGlobalSheet or dtLocalSheet), and check data types.

Explore: All Software Training Courses.

Conclusion

You’ve made the first giant leap into the realm of software automation testing with QTP/UFT One. From learning about its key functionalities such as Object Recognition and the Object Repository to becoming a master of Record and Playback and harnessing the power of VBScript, you now possess the basic knowledge to automate your first tests.

Set to raise your QTP/UFT One skills a notch higher? Join a full UFT One/QTP training course in Chennai today and be an automation wizard!

Share on your Social Media

Just a minute!

If you have any questions that you did not find answers for, our counsellors are here to answer them. You can get all your queries answered before deciding to join SLA and move your career forward.

We are excited to get started with you

Give us your information and we will arange for a free call (at your convenience) with one of our counsellors. You can get all your queries answered before deciding to join SLA and move your career forward.