We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

When parentheses should be used in in TestScript?

 

The customserver has some functions namely the Recordable function and helper function. Summarizing both and looking from the TestScript view, there are functions with return type and functions without return type. The function with return type can be compared to Function Procedure and function without return type can be compared to Sub Procedure, they are described generically as functions in the custom server.

All recordable functions are Sub Procedure as they do not have a return type, while most of the helper functions are Function Procedure. Call to Sub procedure does not require parentheses but call to Function Procedure require parentheses.

VB

 

root = SwfWindow("SwfWindow").SwfObject("SwfObject").TraceParentRoot("Menu 13")

MsgBox root

SwfWindow("Form1").Move 659,249

SwfWindow("Form1").Click 22,187,MIC_RIGHT_BUTTON

SwfWindow("SwfWindow").SwfObject("SwfObject").Select "Parent Menu 3;Parent Menu 6;Menu 13"

'call SwfWindow("SwfWindow").SwfObject("SwfObject").Select ("Parent Menu 3;Parent Menu 6;Menu 13")

In the example script above, TraceParentRoot is a helper function with a return type, therefore used with parentheses. This can be treated like Function procedure.

Select is a recordable function and do not have a return type, therefore used without parentheses. This can be treated like Sub Procedure.

Note on the last commented script : Call is optional, but when call is used, parentheses are must for the Sub procedures.

Article ID: Published Date: Last Revised Date: Platform: Control:
1846 04/30/2011 07/10/2014 Windows Forms QTP Add-On
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon