UFT Tutorial | Create Test Case in UFT – An Excellent Step by Step Guide for UFT 14.x

Create Test Case in UFT - Feature Image

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.

About K Mondal

Hi, I am K. Mondal, I am associated with a leading organization. I am having 12+ years of working experience across domains e.g., application development, automation testing, IT Consultant. I am very much interested in learning different technologies. I am here to fulfill my aspiration and currently contributing as an Author and Website Developer both in LambdaGeeks.
Connect to LinkedIn- https://www.linkedin.com/in/kumaresh-mondal/

Leave a Comment

Your email address will not be published. Required fields are marked *