Once you have installed the UFT either licensed or trial
version (valid for few days around 60 days) then you can have a logo as shown
here.
Follow the steps to create a Test script in UFT
1. Click on the UFT logo to open the tool
2. Add-In
Manager window will be shown with the add-Ins you have selected during the
installation process. Now, select the Add-in (Example: Web) that you would like
to work on the type of application that you have desired and click Ok button
3. You will be landed
on UFT Home screen with different Bars, Tabs and Panes as shown here
4. To create a new
test script, select File >> New >> Test Menu and then select the
Type of Test (Example: here select GUI
Test and give a appropriate name to your script and click Create button
Now, will TAKE A TOUR to know about the UFT
features/overview Menu wise
FILE Menu
Select File >> New – creates a new test script
Select File >> Open – Opens a windows explorer to view the existing test
scripts
Select File >> Add – Opens a option to select new test script as well as
to view the existing test scripts
Select File >> Close – Closes opened test script
Select File >> Close Solution – Closes opened test script along with test resources
Select File >> Save [Test script] – Saves opened test script
Select File >> Save [Test script] As – Prompts to provide another name to opened test
script
Select File >> Save All – Saves opened test script along with test resources
Select File >> Save (Other) – Saves opened test script along with test resources
in ALM
Select File >> Recent – Opens a recently opened test scripts
Select File >> Settings – Opens a Settings dialog box to provide customized settings on the opened test script
File >> Settings>>Properties
Select File >> Settings>>Properties – You can select or deselect the selected Add-Ins by
clicking Modify button, based on
your requirement. For example if you selected multiple add-ins then here in the
settings properties you will have provision to select or deselect as per your
choice.
Generate Script – It generates you an automation script on the test settings part. This code
will help you to do the settings during run time instead of you doing before
execution of the test script using manual intervention.
File >> Settings>>Run
Select File >> Settings>>Run – By default the iterations will be “Run all rows”. Suppose your test
data has multiple rows then the test script will run for all the rows you have
given.
Run one iteration only – Suppose you want to restrict to execute one row
test data then do the necessary settings before executing the test script otherwise
you can handle the same using the automation code.
Run from row [Row number] to row [Row number] – Choose if you want to execute few test data rows
for your test script
When error occurs
during run session – you will have multiple choices to select when error
found while your test script is running
o
Pop Up
message box - A pop up displays with
the error details
o
Proceed
to next action iteration – Exit the current action and switch to next
action iteration
o
Stop run
– Stops run completely
o
Proceed
to next step – Proceed to next statement if it found an error at current
statement
Object
Synchronization – Synchronization is a waiting time to load or render the
object on to the web page. Here UFT waits for the browser to load the object
that you are working one. It’s a mutually waits in order to load and recognize
the object that you wanted the object to do some task. Here by default the synchronization timeout has
given as 20 seconds. You can change these settings based on the latency or
performance of your application.
Smart Identification
– If the UFT found the similar object description on more than one object
then in order to identify these similar objects uniquely one should use smart
identification feature.
Save Image – Choose
the option if you have to save the desktop image when error occurs
File >> Settings>>Resources
Select File >> Settings>>Resources – Associate all your library functions either stored in
your local drive or HP ALM (test data management tool, Test Plan is the module
location where your automation test scripts will be available) to your test
script
NOTE: Here,
while associating UFT asks your choice to store these files with Absolute or
Relative path
Data Table: UFT
has default excel sheet i.e, Data Table where you can use this feature to store
the test data just as a excel sheet. These test data will be picked during run
time based on the logic you applied in the test script
Or else, if you are using any
external files such as excel sheet then provide that path under Other location option provided by the
UFT and click OK button to apply
your settings to the current test script.
File >> Settings>>Environment
Select File >> Settings>>Environment – Environment variables are of two kinds. Those are
built-In and user-defined. Built-Ins are those variable that were provided by
the UFT and user-defined are those that were defined by the user. There so many
listed by UFT, based on your requirement make use of them
Examples on Built-In:
1.
Msgbox Environment.Value(“ActionIteration”)
2.
Msgbox Environment.Value(“ActionName”)
3.
Msgbox Environment.Value(“OS”)
4.
Msgbox Environment.Value(“OSVersion”)
Examples on user-defined: Once you click on +
symbol a pop up would open where it asks you to provide the Name and Value. Provide the details and click on OK button to apply. Basically, we use these options when user wants
to pass any constant values to pass into the test script during run time
1.
Msgbox Environment.Value(“CompanyName”)
2.
Msgbox Environment.Value(“CompanyBadgeID”)
Here
variables CompanyName and CompanyBadgeID are given against Name label and corresponding input will be provided against Value label. These values will be
displayed if you use the code mentioned as shown in the example.
Load variables and
values from external file – other option given to provide the list of
user-defined variables in one go by specifying that file path.
File >> Settings>>Web
Select File >> Settings>>Web – The default browser navigation timeout is 60 seconds ,
else you have choice of changing the timeout based on your application latency
or performance.
File >> Settings>>Recovery
Select File >> Settings>>Recovery – Recovery Scenario, apart from your application navigation / flows
according to your business functionality if there are any intermittent/unexpected pop ups/
dialogue boxes / child pages appears then you have to use the Recovery
scenarios that are provided by the UFT.
Here you need to take a wise decision
based on the type of recovery scenario that you experienced. Mostly, intermittent/unexpected situation happens on same page and never know after how many iterations it
would appear and another scenario is you don’t know even which page it would appear
or when and how. Based on your experience you have to use Activate recovery scenarios options provided by the UFT (Example: On
error option from the Activate
recovery scenarios drop down shown) and
click OK button to apply the Recovery scenario(s) to your test script.
You will learn Recovery
Scenario creation later point in time with more details.
File >> Settings>>Log Tracking
Select File >> Settings>>Log Tracking – Check the box if you wanted to have log messages to
the run results
File >> Settings>>Local System Monitor
Select File >> Settings>>Local System
Monitor – Enable local system monitoring every second if you want to monitor the local system performance
Select File >> Export Test – Opened test script would be exported to desired
location
Select File >> Import Test – Opened test script would be imported to UFT coding
pane
Select File >> Exit – UFT closes itself and closed all opened test script
and other test resources (prompt to save if anything is not saved)
EDIT Menu
Select Edit >> Undo – Reverse your last action performed by you
Select Edit >> Redo - Reverse your more than one action performed by you
Select Edit >> Cut – Takes out the statement(s) selected
Select Edit >> Copy – Takes a copy of the statement(s) selected
Select Edit >> Paste – The statement(s) selected by Cut or Copy will be
pasted
Select Edit >> Delete - Delete
the selected statement(s)
Select Edit >> Format>>Comment – The comment will be denoted by apostrophe (‘) symbol.
You can action the same for single or multiple statements
Select Edit >> Format>>Uncomment – Deselects the comment placed
Select Edit >> Format>>Indent – Adjust or aligns the code for easy readability
Select Edit >> Format>>Outdent – Undo the Indent
Select Edit >> Format>>Complete Word – Provides the information to complete the statement
Select Edit >> Format>>Argument Info – Provides the information related to the arguments or
parameters
Select Edit >> Format>>Apply “With” to
Script – The similar statements found
in your code use these feature for more readability
Select Edit >> Format>>Remove “with”
Statement – Undo the Code that is
applied to “With” Keyword
Select Edit >> Code Snippet>>If…Then – Shows you the If
… Then syntax to write the code that conditional block
Select Edit >> Code Snippet>>ElseIf…Then –
Shows you the If … Then syntax to write the code that conditional block
Select Edit >> Code Snippet>>Else – Shows you the Else
syntax to write the code that conditional block
Select Edit >> Code Snippet>>While … Wend
– Shows you the While … Wend syntax to write the code that conditional block
Select Edit >> Code Snippet>>For … Next – Shows you the For
… Next syntax to write the code that conditional block
Select Edit >> Code Snippet>>Do …While – Shows you the Do
…While syntax to write the code that conditional block
Select Edit >> Code Snippet>>Do …Until – Shows you the Do
…Until syntax to write the code that conditional block
VIEW Menu
Select
View>>Solution Explorer – Displays the hierarchy of the Test case
with their actions and object repositories
Select View>>Toolbox
– Displays the list of all Library, local function and the list of all the
Objects that are associated to the Object Repositories
Select View>>Properties
– Displays the Action Name, Location, Parameter of the selected Actions or
Object Repositories
Select View>>Data
– Displays default Data Table of the UFT
Select View>>Output
– Displays output checkpoint values
Select View>>Errors
– Displays all related errors of the opened test script
Select View>>Active
Screen – Will display the active screen if the option is checked in the
setting while you have selected relevant object
Select View>>Debug>>Breakpoints
– Breakpoints are used to pause the execution in the middle for you to
investigate or watch the values during run time.
Select View>> Debug>>Call
Stack – Display the sequence of calls your script has made up until that
point.
Select View>> Debug>>Loaded
Modules – Display the loaded modules your script has made up until that
point.
Select View>> Debug>>Threads
- Display the threads your script has made up until that point.
Select View>> Debug>>Local
Variables - Display the local variables your script has made up until that
point.
Select View>> Debug>>Console
– Displays the output on console
Select View>> Debug>>Watch
– Displays the current value of variable added
Select View>> Debug>>Tasks
– Tasks that has to perform in future will be displayed
Select View>> Debug>>Search
Results – Displays the search results
Select View>> Debug>>Bookmarks
– Bookmarks would be displayed
Select View>> Debug>>Test
Flow – Test Flow would be displayed
Select View>> Debug>>Run
Step Results – Run Step Results would be displayed
Select View>> Debug>>Keyword
View – Keyword view would be displayed
Select View>> Debug>>Start
Page – Display the Stat page
Select View>> Debug>>Last
Run Results – Display the last run results
Select View>> Debug>>Reset
Window Layout – Will the reset the Window Layout
Select View>> Debug>>Switch
To BPT View – Switch to BPT View from Test script view
SEARCH Menu
Select Search
>> Find – To search desired text
Select Search
>> Replace – To search desired text and replace with the text
provided to replace with
Select Search
>> Incremental Search – Search the desired text in forward direction
continuously
Select Search
>> Reverse Incremental Search - Search the desired text in backward
direction continuously
Select Search
>> Bookmarks – Bookmarks are used for future purpose
Select Search
>> Go To >> Location – Places you on the line location you
wanted
DESIGN Menu
Actions - Actions, are the re-usable code (brunch of statements) that can be used wherever you wanted. You can use the Actions multiple time as required based on the business logic.
Actions are of three types.
- Call to New Action
- Call to Copy of Action
- Call to Existing Action
Select Design
>> Call to New Action – It creates a new action in order to make
these action as reusable or non-reusable based on the user choice during
creation
Select Design
>> Call to Copy of Action – It creates a duplicate action of an
existing action. Newly created action can be made modification to the code that
is already there but existing will not get impacted with modification made to
the new action.
Select Design
>> Call to Existing Action – It calls existing action and works as
reusable components. Will be used as it wherever you have called.
Select Design
>> Call to Existing API Test / Action - It calls existing API Test and Action and works as
reusable components. Will be used as it wherever you have called.
Select Design
>> Checkpoint>>Existing Checkpoint – Validations on any text
checkpoint can be created and also get the list of existing checkpoints created
already
Select Design
>> Checkpoint>>Database Checkpoint - Validations on any
Database checkpoint can be created and also get the list of existing
checkpoints created already
Select Design
>> Checkpoint>>XML Checkpoint - Validations on any XML
checkpoint can be created and also get the list of existing checkpoints created
already
Select Design
>> Checkpoint>>File Content Checkpoint - Validations on any
File Content checkpoint can be created and also get the list of existing
checkpoints created already
Select Design
>> Output Value>>Existing Output Value – Existing Output value
will be displayed
Select Design
>> Output Value >>Database Output Value – Database Output value
will be displayed
Select Design
>> Output Value >>XML Output Value - XML Output value will be
displayed
Select Design
>> Output Value >>File Content Output Value – File Content Output
value will be displayed
Select Design
>>Start Transaction – Place the start transaction at the beginning of
your test script
Select Design
>>End Transaction - Place the End transaction at the beginning of
your test script. The difference of end and start transaction would be your
execution time of you test script.
Select Design
>>Check Syntax – Checks any syntax and notifies you if there are any
errors to your test script
Select Design
>>Step Generator – Step Generator, there are 3 kinds of Categories
1.
Test Objects
2.
Utility Objects
3.
Functions (as shown in below snapshot)
a.
Library Functions
b.
Built-In Functions
c.
Local Functions
Utility Objects and their Objects & Operations, see in below snapshot
Functions and their Built-In Library Functions & Operations, see in below snapshot
Steps to use Step
Generator
- Select Design
>>Step Generator
- Select
any one category
- Choose
any one library or Object
- Select
any one operation
- In
the arguments section provide Name, Type and Value
- Optional,
select Return value option if required
- You
will have code generated automatically under Generated Step section
- Click
OK button to add this step to your
test script and you want more code to append then select the Insert another step
- Finally, click on OK button to close the Step Generator
Select Design
>>Function Definition Generator…
There are two types functions
definition generator are available
1. Function
2. Sub
Both are similar but function can return a single value wherever
they were called nevertheless Sub can’t. Both uses multiple parameters. Here to
the parameter you can use below keywords additionally.
ByRef
– Provides a pointer to the variable and any changes are reflected anywhere
that variable is used. Simply, changed value will be returned though wherever
it will be called.
ByVal
- Provides a copy of a variable to a routine (sub or function), so any changes
to that variable will not be reflected in the original routine (sub or
function). Simply, changed value scope will be to that sub or function only.
Example:
valueA=10
valueB=30
Msgbox valueB
Msgbox valueA
Public Function NewFunction (ByRef valueA, ByVal
valueB)
valueB=
valueB +10
valueA=valueA+10
Msgbox valueB
Msgbox valueA
End Function
Output: valueA valueB
Main 20 30
Function 20 40
Steps to use Function
Definition Generator
1 Select Design >>Function Definition
Generator…
2. Provide
new function name to the function
definition
3. You
will have to options Function or Sub from Type drop down
4. Select
the Scope either Public or Private
- Public – Will have scope to the entire
test script or across Actions
- Private – Will have scope to the
current block or function or to that Action
5. Select
the “Register to a test object” in
order to get the list of Test Objects and Operation list otherwise do not
select.
6. Then
based on your selection code will be generated under Preview section
7. Select
Insert another function generator if
you want more else click OK button
to get the append this code to your test script
RECORD Menu
Select Record>>Record – Will do the recording as per your navigation/triggers
on chosen applications that you made
Select Record>>Web Event Recording Configuration
– You can set Web Event recording
configuration levels as per your desire using Custom Settings button
Select Record>>Record And Run Settings – Based
on the add-in you selected, those list of add-in will be displayed in separate
tabs (Example: Web tab is displayed
below along with their settings as shown below)
Settings / Features are very
easy for you to understand. Mainly, two things you should know.
1.
Record or run test on any open browser – Opens the URL on the opened browser only
2.
Open the following when a record or run session begins - Here you have provide Browser and Address fields in
order to open the URL on the specified browser
RUN Menu
NOTE: To
have debugger features you should have Microsoft
debugger installed separately in your local machine
Also, RUN Modes are of three types were discussed below
- 1.
Default Run Mode
- 2.
Maintenance Run
Mode
- 3.
Update Run Mode
Select Run >> Run – You will be prompting with two options on Results Location tab on Run window as shown below. It’s a
normal/default RUN, starts execution
from begining of the step to last step of your test script.
1. New run
results folder – It will show the
path where test script is stored (either your local drive or ALM path would be
shown) and there itself results folder will be created. Now, you can click RUN button to execute you test script
2. Temporary
run results…… If you don’t want to
store your test results either on your local drive or in ALM path, choose this
option and click on RUN button to
execute you test script
Select Run >> Run Now – Will run your test script immediately
Select Run >>Recent Reports – Will be shown your recent test results reports
Select Run >>Step Into – Executes line by line and resumes for your action to
move forward
Select Run >>Maintenance Run Mode - During run session Maintenance Run Mode helps you to update the test objects in
the object repositories associated to your test script or component
when UFT cannot locate one or more objects in your application.
Select Run >>Update Run Mode - Updates all properties of objects and checkpoints in
case of failures
Select Run >>Run Current Action – Executes the desired Action only
Select Run >>Run from Step – Execute the test script from the beginning or location
you specified until reaches the breakpoints you specified
Select Run >>Run to Step - Execute the test script till last step or up to the breakpoints you specified from the location you started the execution
Select Run >>Debug from Step – Execute the test script from the location you wanted
and executes up to the last step or until the breakpoints you specified line by
line
Select Run >>Insert/Remove Breakpoint – Insert or removes the breakpoints(s)
Select Run >>Enable/Disable Breakpoint - Enable or disable the breakpoints(s)
Resources Menu
NOTE: Object
Repository are of two kinds, Local and Global/Shared Object Repository
Select Resources>>Object Repository – Object Repository is used to spy the application
objects and store them in order to use these objects during design the
automation code. Local object repository mainly comes into picture when you are
using Actions to your test script otherwise not required
Select Resources>>Object Repository Manager - It’s facilitates
you to create a global object repository like said above it will be used to
store the GUI objects and helps you to store in your local desktop or in the
ALM for future reference for your coding.
It also helps to add all the
objects in one go as well and also helps you to merge two object repositories
at a single instance.
Select Resources>>Associate Repositories – It facilitates you to map the object repository to the
actions or test script
Select Resources>>Map Repository Parameters - It facilitates you to map the parameters to the object
repository
Select Resources>>Recovery Scenario Manager…. It facilitates you to map the recovery scenarios, to
create the scenarios etc., Details steps to create Recovery Scenario were
discussed here later section below
ALM Menu
ALM Connection on UFT
– Interaction of HP ALM & HP UFT
Select ALM>>ALM
Connection… - Once you select it will populate with another window to you
to provide the ALM Server URL, User name, Password as shown below and also
details with Domain and Project details. Choose the appropriate as per project
you involved and click Login button
to interact with ALM Test Plan module.
Restore connection on
startup – If you desired to restore the ALM connection as soon as UFT icon
is clicked then choose the option here itself.
Tools Menu
Select Tools >> Object Spy… Once you select it will provide you Object Spy (1st
icon – pointing hand) window, using
Hand Symbol you have to locate the application GUI objects and if want the
object to add to OR permanently you have + icon (3rd icon – add object to the repository) which is
beside it.
2nd icon (highlight in application) is to
highlight object in the application.
4th icon is used
to copy the identification properties to
the clipboard
Select Tools >> Object Identification – Based on the add-in selected and the default add-in
will be listed under Environment drop down. Based on the selection respective
Test Object Classes will be displayed. Try selecting any Test Object Class then
you will be seeing the Mandatory and
Assistive Properties
correspondingly.
Ordinal Identifier – In general when you execute the test script by default UFT identifies
the object by Index or Location of the object.
Enable Smart Identification – We already discussed in File >> Settings
Generate Script – It will provide automating code to you related to Object
Identifications this code will help you in future
Select Tools >> Regular Expression Evaluator… Regular expression are those when we see a dynamic
value change in the application then you need to use regular expressions in
order to make the object(s) identify in future as well without any issue when
you execute at 1000 time too.
Regular Expression Evaluator window helps you to provide your regular expression
and see the behavior by providing the sample text
Select Tools >> Data Driver – Use Add Value button
and provide parameters, these constants value you wanted will be automatically
added to "Action 1" in your default Data
Table.
NOTE: the first tab is the global sheet
Select Tools >>Virtual Object>>New Virtual
Object – Details steps are available
below in order to create Virtual Object.
Virtual
Object will be created only when the UFT doesn’t recognize though it has seen
as lets say Button by human eye. Likewise, any GUI object if it is not
recognized use Virtual Object.
Select Tools >>Virtual Object>>Virtual
Object Manager – Display the list of Virtual Objects created already.
Steps to Create Virtual Object
1.
Select Tools >>Virtual Object>>New
Virtual Object
2.
Click Next button Welcome Virtual Object Window
3.
Select any
desired Class from Map to a Standard Class window and
click Next button
4.
Click on Mark
Object in order to spy that desired object and click Next button as shown in the
below snap.
5.
Now, Select Parent only or Entire parent hierarchy based on the newly selected object hierarchy and click Next button
6.
Save Virtual
Object. Here choose option if you want to add further more virtual object by
Yes or No and finally click on Finish
button
Select Tools >> GUI Testing>> General – Suggest you to familiar with the options you have in General tab and use them based on the
project requirement
Select Tools >> GUI Testing>> Test Runs - Suggest you to familiar with the options you have in Test Runs tab and use them based on the
project requirement
Select Tools >> GUI Testing>> Text
Recognition - Suggest you to familiar
with the options you have in Text
Recognition tab and use them based on the project requirement
Select Tools >> GUI Testing>> Folders - Suggest you to familiar with the options you have in Folders tab and use them based on the
project requirement
Select Tools >> GUI Testing>> Active
Screen - Suggest you to familiar with
the options you have in Active Screen
tab and use them based on the project requirement
Select Tools >> GUI Testing>> Screen
Capture - Suggest you to familiar with
the options you have in Screen Capture
tab and use them based on the project requirement. Mostly related to screen or movie capture
Select Tools >> GUI Testing>> Insight - Suggest you to familiar with the options you have in Insight tab and use them based on the
project requirement.
Select Tools >> GUI Testing>> Remote
Connection - Suggest you to familiar with
the options you have in Remote
Connection tab and use them based on the project requirement. It will be
useful when you wanted to execute the test scripts in remote machine. Here you
need to have required SSL certificates in your local machine
Select Tools >> GUI Testing>> Web
>>General - Suggest you to familiar
with the options you have in General
tab and use them based on the project requirement.
Select Tools >> GUI Testing>> Web
>>Page/Frame Options - Suggest
you to familiar with the options you have in Page/Frame Options tab and use them based on the project
requirement.
Select Tools >> GUI Testing>> Web
>>Advanced - Suggest you to familiar
with the Accessibility Checkpoint options you have in Advanced tab and use them based on the
project requirement.
Recovery Scenario - Apart from your application navigation / flows according to your business functionality if there are any intermittent pop ups/ dialogue boxes / child
pages appears then you have to use the Recovery scenarios that are provided by
the UFT.
Here you need to take a wise
decision based on the type of recovery scenario that you experienced. Mostly, intermittent situation happens on same page and never know after how many
iterations it would appear and another scenario is you don’t know even which
page it would appear or when and how. Based on your experience you have to use Activate recovery scenarios options
provided by the UFT (Example: On error option from the Activate recovery scenarios drop-down shown) and click OK button to apply
the Recovery scenario(s) to your test script.
Here are the steps involved in creating the Recovery
scenario(s).
1. Click New Scenario icon on the above snapshot
2. Choose the Next button
3. Select the
desired Trigger Event listed as Radio button as per your requirement and click Next button
4. Now, specify the
unexpected Pop window that you experienced with the help of HandSymbol button. Then it
automatically captures the Window Title
and also text contains in it. Here
you can use Regular Expression if you wanted to pick the pop up dynamically and
click on Next button.
5. Click Next button and provide the Operation Type you wanted to perform an
action according to your need and click Next
button on the Recovery Operation
window
6. Now, select Click Button or Press Key options (Select Keyboard or Mouse operations) and click Next button
7. Then, you will be
prompted for another recovery scenario if you wanted to add and click Next button
8. Provide any one
from the list of Test run options as
a post-recovery event to be performed and click Next button
9. Title to your
recovery scenario created and click Next
button
10. Finally, based on your requirement or choice you
can choose Add scenario to current test
and also Add scenario to default test
settings and click Finish
button.