Optional Steps in UFT

Master the use of Optional Steps in UFT or QTP. Understand what are optional steps.

Master the use of Optional Steps in UFT or QTP. Understand what are optional steps
While automating with UFT, we face scenarios where a step is not necessarily required to complete a run session successfully.

Consider a scenario where you add login steps to your code because the application you are testing prompts to enter a username and password in a login window. Consider also that this application remembers user login details so that you do not need to login every time you open the application.

During a run session, the application does not prompt you to enter your user name and password because it retained the information previously entered. In this case, the steps that you added for entering the login information are not required. We should mark these steps optional.

Once these steps are marked optional, during the subsequent run sessions, if the object of an optional step does not exist in the application, UFT bypasses this step and continues to run the test or component. At the end of the run session UFT displays a message for the optional step, which it did not execute. Nevertheless, the step does not cause the run to fail.

However, run fails if UFT cannot find the object from the optional step in the object repository during a run session. This can happen due to object name modification in the test or component but not in the object repository, or if the object was removed from the object repository.

You can also manually designate steps as optional. For example, you can add conditional statements or use recovery scenarios to click a button automatically, press ENTER, or enter login information in a step.

During a recording session, UFT automatically marks steps that open certain dialog boxes as optional.

Default Optional Steps in QTP / UFT

By default, UFT considers steps that open the following dialog boxes or message boxes as optional steps:
Dialog Box / Message Box Title Bar
File Download
Internet Explorer
Enter Network Password
Security Alert
Security Information
Security Warning
Username and Password Required
How to Set Optional Steps in UFT?

To set optional steps, do one of the following

Option 1: In the Keyword View, right-click the step and select Optional Step. UFT adds Optional Step

Option 2: In the Editor, add OptionalStep to the beginning of the VBScript statement. For example: OptionalStep.Browser("Browser").Dialog("AutoComplete").WinButton("Yes").Click



AngularJS,3,Automation Testing,8,CSharp,5,Disqus,1,Excel,2,HP ALM,5,HTML5,1,ISTQB,2,Java Script,2,Manual Testing,7,Photography,1,Quiz,2,REST API,5,Testing,15,UFT,8,VB,5,VBScript,1,Wordpress,1,
Aneejian: Optional Steps in UFT
Optional Steps in UFT
Master the use of Optional Steps in UFT or QTP. Understand what are optional steps.
Loaded All Posts No posts found VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU ARCHIVE SEARCH ALL POSTS No post found which matches with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy