Introduction
Learning Quality Test Professional (QTP) may be intimidating for beginners. Struggling with complicated setup, puzzling interfaces, and complex concepts? Our step-by-step QTP tutorial for beginners bypasses the gibberish! We demystify the must-haves, emphasizing real-life steps to help you automate tests in a flash. Ready to learn test automation like a pro? See the complete QTP course syllabus now!
Why Students or Freshers Learn QTP?
Freshers and students must learn QTP (now UFT/Unified Functional Testing) as it:
- Enhances Employability: QTP/UFT is a top enterprise-level automation tool that is still in use by major corporations.
- Facilitates Automation: Supports automation of functional and regression testing, which is a much-sought-after skill.
- Is Easy to Learn for Beginners: Aspects such as the simple GUI and Record & Playback make it beginner-friendly.
- Provides Scope for Career: Paves the way for specialized posts such as Automation Test Engineer or QTP/UFT Tester.
- Imparts Key Concepts: Gives a solid grasp of automation frameworks and testing methods.
- Needs VBScript: It employs VBScript, which is easy to master for script customization.
Review your skills with our QTP interview questions and answers.
Check your knowledge level with our smart Knowledge Assessment Tool
- Instant skill evaluation with accurate scoring
- Identify strengths and learning gaps easily
- Designed for students and working professionals
- Smart assessment to guide your career growth
Take Your Eligibility Report Instantly
Step-by-Step QTP Tutorial for Beginners
Micro Focus Unified Functional Testing (UFT), commonly referred to as still QTP, is the leading industry tool for functional and regression test automation. The tool relies on VBScript as its native scripting language. This step-by-step QTP tutorial for beginners will guide you through writing your very first automation script.
Step 1: Getting Acquainted with Basic Concepts
Before working within the tool, you need to understand a few basic UFT concepts:
- Test Object: Any application object being tested (e.g., a button, a text box, a link). UFT accesses the test object.
- Run-Time Object: The runtime object in the application during test execution.
- Object Repository (OR): A single repository in which UFT stores the unique properties (such as name, class, ID) that identify each Test Object.
- Action: A block of reusable code, like a function. One or more actions make up a test.
- Checkpoints: Points of validation that are placed inside a test to verify the value or property of an object against an anticipated value.
- VBScript: The scripting language that UFT employs. It’s easy to master and is instrumental in automating your tests to suit your needs.
Step 2: Setting Up Your First Test
2.1 Start UFT and Choose Add-Ins
- Launch UFT: Open the Micro Focus Unified Functional Testing application.
- Add-in Manager: The Add-in Manager window opens. You need to choose the add-in corresponding to the technology of the application you want to test (e.g., Web, .NET, SAP, Java).
- Create a New Test: Navigate to File > New > Test (or press Ctrl + N). Select Functional Test.
- Save the Test: Save your test in a special folder. This folder will hold all your test resources.
2.2 Familiarize yourself with the UFT Interface
The UFT Integrated Development Environment (IDE) consists of three main areas:
- Keyword View: A table-based view that lists test steps in natural language (suitable for beginners).
- Expert View (VBScript): The editor where the actual VBScript code is viewed and modified (suitable for experts).
- Object Repository: Enables you to control the objects identified by UFT.
Step 3: Recording Your First Test Script (Record & Playback)
The simplest method of beginning is via the Record option, which records VBScript code automatically based on your action.
- Begin recording: Click the Record button (red circle icon).
- Recording Options: A dialog box will ask you to specify the application/browser to open. Choose the browser/application and click Record.
- Perform Actions: UFT will go into the background, and the recording toolbar will be displayed. Now, use your application the same way a user would.
Example Scenario: Login to a dummy website.
- Open the application URL (or it will open automatically).
- Enter “Tester” in the Username field.
- Enter “password” in the Password field.
- Click the “Login” button.
- Click the “Logout” link.
- Stop Recording: Click the Stop button (a black square icon) on the floating recording toolbar.
Reviewing the Generated Code (Expert View)
After you record, change to the Expert View. You will find VBScript code like this:
‘ Code automatically generated by UFT
Browser(“title:=HP MyFlight Sample Application”).Page(“title:=HP MyFlight Sample Application”).WebEdit(“name:=username”).Set “Tester”
Browser(“title:=HP MyFlight Sample Application”).Page(“title:=HP MyFlight Sample Application”).WebEdit(“name:=password”).SetSecure “42f2b3b7546654a13f6312a0212f37c3”
Browser(“title:=HP MyFlight Sample Application”).Page(“title:=HP MyFlight Sample Application”).WebButton(“name:=Login”).Click
Browser(“title:=Welcome: Mercury Tours”).Page(“title:=Welcome: Mercury Tours”).Link(“text:=SIGN-OFF”).Click
- Browser(“.”).Page(“.”).WebEdit(“.”).Set “.”: This syntax is how UFT addresses an object and does something with it.
- WebEdit: The Test Object class (a text box).
- Set: The action/method done (typing in text).
Step 4: Parameterization and Data Driving
Hard-coded values (such as “Tester” and “password”) are not effective. Parameterization enables your test to execute with a series of data sets from an outside source, making one test become a robust data-driven test.
4.1 Accessing the Local Data Table
UFT has a built-in Data Table (like an Excel spreadsheet) which is the backbone of parameterization.
- Open Data Table: In UFT, navigate to File > Settings > Data Table. It is also accessible from the Data Table tab at the bottom of the IDE.
- Create Parameters: Insert new columns in the default Action1 sheet (your local data sheet for the current action).
- Column 1: Username
- Column 2: Password
- Insert a couple of rows with various login credentials (e.g., user1/pass1, user2/pass2).
- Replace Hardcoded Value with Parameter:
- Navigate to the Expert View and locate the line containing the hardcoded username:
Browser(“…”).Page(“…”).WebEdit(“name:=username”).Set “Tester”
- Change “Tester” to the Data Table parameter syntax:
Browser(“…”).Page(“…”).WebEdit(“name:=username”).Set DataTable(“Username”, dtLocalSheet)
- DataTable(.) instructs UFT to retrieve the value from the Data Table.
- “Username” is the name of the column you defined.
- dtLocalSheet denotes the local sheet (for the action being executed currently).
- Repeat the same for Password: Do the same for the password field.
4.2 Setting the Run Options
To execute the script against all the rows of data, you must set up the run settings:
- Open File > Settings > Run.
- In Run Session, check Run on all rows for the current Action/Iteration.
- When you Run the test (green arrow icon), UFT will now perform the login and logout steps for all the rows of data in your table.
Step 5: Adding a Checkpoint (Verification)
A Checkpoint is not useful unless you verify. A Checkpoint confirms your application is doing what it should.
- Insert Checkpoint: Navigate to the place in your script where you wish to confirm something (e.g., after a successful login).
- Click Insert > Checkpoint > Standard Checkpoint.
- Select Object: UFT will ask you to click on the object you wish to verify. Click on the text that displays after a successful login (e.g., “Welcome, Tester”).
- Set Checkpoint: In the Standard Checkpoint Properties dialog, choose the property to check (for example, the text property) and enter the expected value (for example, “Welcome, Tester”).
- VBScript Output: UFT adds a line of code such as this:
‘ Checkpoint for successful login verification
Browser(“title:=Welcome: Mercury Tours”).Page(“title:=Welcome: Mercury Tours”).WebTable(“text:=Welcome, Tester”).Check CheckPoint(“Welcome Message”)
Step 6: Descriptive Programming (Advanced Object Handling)
Sometimes, an object may not be stored in the Object Repository, or its properties may dynamically change. Descriptive Programming (DP) enables you to specify objects by their properties directly within the VBScript code, without going through the OR.
How to use DP:
- For objects changing their properties regularly.
- For objects appearing once only (to prevent filling the OR with them).
DP Syntax Example:
Rather than this code based on the Object Repository:
Browser(“title:=HP MyFlight Sample Application”).Page(“title:=HP MyFlight Sample Application”).WebButton(“name:=Login”).Click
You utilize a description object (Description.Create()) and the ChildObjects method:
Set oDesc = Description.Create()
oDesc(“micclass”).Value = “WebButton” ‘ Identify the class of the object (e.g., button, link)
oDesc(“name”).Value = “Login” ‘ Identify the unique name property
‘ Use ChildObjects on the Parent Page to find the Button
Set oButtons = Browser(“title:=HP MyFlight Sample Application”).Page(“title:=HP MyFlight Sample Application”).ChildObjects(oDesc)
‘ Click the first object found that matches the description
oButtons(0).Click
‘ Clean up the description object
Set oDesc = Nothing
Set oButtons = Nothing
This code instructs UFT: “On this page, locate an object with class ‘WebButton’ and name ‘Login’, and click it.”
Step 7: Conclusion and Analyzing Results
- Run the Test: Click the Run button (green arrow) to run your parameterized test script. UFT will run the script for each data row.
- View Results: The Run Results Viewer opens automatically after execution.
- Analyze:
- Pass/Fail Status: See the overall status for each iteration (data row).
- Checkpoints: Go through the exact checkpoint to ensure if the actual value was equal to the expected value. Failures at this point are of severe consequence.
- Screenshots: In case of failures, UFT tends to take screenshots, which is useful while debugging and reporting defects.
Mastering recording, parameterization, checkpoints, and descriptive programming, you have now learned the most fundamental skills required to start off as a UFT automation tester! Explore more with our QTP challenges and solutions.
Real Time Examples for QTP Tutorial for Learners
Following are some real time examples for a beginner QTP/UFT tutorial:
Example 1: E-commerce Search for Product and Validation
- Scenario: Check that searching for a product shows the expected search result and price.
- Steps:
- Record: Go to a product search field and enter a product name (e.g., “laptop”).
- Action: Press the “Search” button.
- Checkpoint: Add a Text Checkpoint to check that the expected product name is shown on the results page.
- Output Value: Employ an Output Value to save and retain the real price of the very first product available into the Data Table so it can be used for reporting afterwards.
Example 2: Data-Driven Login Test with Multiple Users
- Scenario: Log in with a set of valid and invalid usernames and passwords.
- Steps:
- Data Table: Design a Data Table with fields for Username, Password, and Expected Result (e.g., “Pass” or “Fail”).
- Parameterization: Substitute the hard-coded login credentials in the recorded script with the Data Table parameters.
- Conditional Logic: Insert VBScript If-Else logic to verify either the “Welcome” message (Pass) or the “Invalid Credentials” message (Fail), and modify the test result accordingly.
Example 3: Managing Dynamic Object Properties (Descriptive Programming)
- Scenario: The ID of a button changes each time the application is started (e.g., btn_submit_123, btn_submit_456).
- Steps:
- Problem: The Object Repository won’t be able to locate the button at playback.
- Solution: Apply Descriptive Programming (DP). Rather than depending on the dynamic ID, identify the object by stable attributes such as its micclass (e.g., “WebButton”) and name (e.g., “Submit”).
- Code Snippet Focus: Demonstrate how to explicitly write the object path in the script, such as Browser(.).Page(.).WebButton(“name:=Submit”, “micclass:=WebButton”).Click.
Click here for more QTP Project Ideas for Beginners.
FAQs About QTP Tutorial for Beginners
1. What is QTP in Testing?
QTP (QuickTest Professional) is a commercial automated functional and regression test tool based on VBScript, used mainly for web, desktop, and enterprise applications.
2. Is QTP easy to learn?
Yes, it is quite easy for starters because it has a Record and Playback feature and is based on the easier-to-learn VBScript language.
3. What is the difference between Selenium and QTP?
Selenium is open source, multi-language (Java, Python, etc.), and is mainly for web applications; QTP (UFT) is licensed/paid, VBScript-based, and supports web and desktop applications.
4. Is it UFT or QTP?
It’s UFT (Unified Functional Testing). QTP was the original name, but it was renamed as UFT by Micro Focus.
5. Which testing is high salary?
SDET (Software Development Engineer in Test) and Test Architect positions, with high skills in automation, development, and designing a framework, are the highest paid.
6. What is QTP called now?
It is Unified Functional Testing (UFT) today.
7. Can I learn testing in 3 months?
You can learn manual testing basics and basic automation (e.g., Selenium fundamentals) in three months with a consistent, planned approach.
8. What is the salary of tester in India?
The salary of a software tester in India is from ₹3.5 LPA (freshers) to ₹18-22 LPA (seniors, specialist). Explore more with our QTP tester salary in India.
9. Which testing is in demand?
Test Automation (Selenium, Cypress, Playwright) and specialized areas such as API Testing, Performance Testing, and AI/ML Testing are very in demand.
10. Is QTP still used in 2025?
Yes, UFT (previously QTP) continues to be used, particularly in large organizations that have invested in licensed Micro Focus tools and non-web applications.
Conclusion
You have completed the basic steps of UFT (QTP) successfully, learning object identification, recording, parameterization, and checkpoints. This QTP tutorial for beginners is essential for durable functional and regression testing in large organizations. Automation is a key skill for career advancement. Ready to level up? Enroll in our comprehensive UFT/QTP Testing Course in Chennai today and become a certified automation expert!
