What is an Optional Step, Make
Optional Step, QTP Optional Step Execution Example
What is an Optional Step ?
When a step declared as optional which is not required or
mandatory to be run or executed. And If the related object
of GUI is available, QTP executed the process on it. And If the
Object of GUI is not available, QTP always bypass the optional
steps and proceed to execute or run the next further step
Quick Test Professional by default, holds the step that will open
the dialog box provided below as the optional step:
Message Boc or Dialog Box title Bar:
AutoComplete
File Download
Internet Explorer
Netscape
Error
Enter Network Password
Security Alert
Security Warning
Security Information
Password and User name mandatory
- Optional steps are not required to complete the run or
execution session.
- Optional Dialog Box step if not open or run then Simply QTP
will avoid the such step and move the further and remain continue
for rest of Run session. And at the end of this session a alert will
display about the left optional step or fail step for run session.
- And if there is not any optional steps and then if QTP fails
for any step then it will display the error message:
We can also add an optional steps in Expert View with adding
optional steps to the beginning of VB Script – For Example:
OptionalStep.Browser(“Browser”).Dialog(“AutoComplete”).WinButton(“Cancel”).Click
Simple Real World Example of Optional Steps:
- First confirm that one
blank IE window or blank test window is open already.
- Now Just click on Record to
start the Recording in QTP.
- Now Go To Start →
Programms → Quick Test Professional → Sample Applications →
Flight
- Now Enter the User Name,
Password and then hit the enter Key
- Now flight Apps will open
and from it Go to on → File – Exit.
- Now need to close the IE
window so close it.
- Now need to stop the
recording so click on Stop to stop.
For Keyword View, Following are the Steps:
Now before we execute the test make sure Internet Explorer window
is NOT open yet.
The idea is when we execute the above explained test without IE,
it doesn't display any error message validation or fail, it will just
bypass the ‘browser closing’ step as we have marked it Optional
and it will ignore any error for the optional step. But it shows us
the warning in the result of test.
Try to run the same test by just removing the ‘Optional Step’
tag from the above lines and see that it will fail and show us the
Run Error.
No comments:
Post a Comment