Articles in this section
Category / Section

When parentheses should be used in in TestScript?

1 min read

 

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.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied