Wednesday, 7 October 2015

Step Generators

By default we use object spy to recognize the object properties in order to write the scripts and we also use Step Generator to create script statements  or steps  like functions,test objects,utility objects in the login script return above we used systemutil,run to open the flight reservation application. We  will discuss first about Functions , Test objects and Utility objects.
Functions : functions return the value to the calling place. Some of the QTP functions are
  • Invoke applications
  • Inputbox
  • Msgbox
  • Wait and etc..

Invoke application:
Invoke applications or system util are used to open the application or launch the application. 
Syntax: Invokeapplication “path of the folder”.
Input Box: 
This function is used to take the input values. If we want to assign a value to a string at that time, we can use this InputBox..
Syntax: Inputbox(“string”, “title”).
Example: x=Inputbox(“enter your name”,”yashaswi”)
Msgbox: this function is used to display the output of an operation or test script..
Syntax: msgbox “string” & result.
Wait: This function is used to pause the execution of a step for fixed time.
Syntax: Wait(time in seconds).
Test Objects: 
Test objects are run time objects. testers are using this create script steps while they are performing operations on the application
Navigations: Click f7 à Select category as “Test objects”àClick on Object Button à Show the hand icon to the object name and click à Click Ok à Enter required text (if flight application enter Agent Name) in the “Arguments” tab à Activate and insert another step Checkbox à Click “insert” à Click on Object Buttonà Show the hand icon to Password and click “ok” à Enter “password” in the “arguments” tab à Click “Insert” àClick on Object button again à show hand icon to “OK”à Uncheck insert another step” check box à Click “Ok” à Close step generator and Login window à Click “ Run” à Analyze the results.
Utility Objects:
QTP rovides several utility objects to enhance the power of Scripting , Utility objects are the reserved objects in QTP . These utility Objects can be used in reporting preferences during  run time. Some of the Utility Objects are like
  • Report event
  • SystemUtil
  • Crypt object. Etc.,

Reporter: reporter is used to get the results in the result window of QTP. It will display the pass or fail criteria of the Scripting we writ in QTP.
Syntax: Reporter.ReportEvent Event status, Report Step Name, details.
Example: reporter.Reportevent Micpass,”results”, “Flight reservation window is opened
SystemUtil.Run: This object is used to launch the application in an automated way.

Syntax: SystemUtil.Run “path of the application”
Vbscripting for login functionality of standalone applications or windows application:
We are going to write the scripting for login functionality of flight application.
SystemUtil.Run “path of the Flight application”
Dailog(“login”).winedit(“attached text:=Agent Name”).Set “ahal”
Dailog(“login”).winedit(“attached text:=Password”).Set”mercury”
Dailog(“login”).winbutton(“attached text:=Ok”).click

No comments:

Post a Comment