|
This feature lets you achieve the following:
Invoking other web scripts from the current one.
Controlling the order of execution of the web scripts that need to be played.
Use Global Variables to set and get values from one script to another
Web Test Studio provides the following built-in functions to do so:
This will transfer the execution control to the called web script. The web script to be called and its location are specified as arguments.
callScript("<Web Script Name>","<Web Script Path>")
For example, assume the web script named test.wcs is present under webscripts/case1/test folder, then callScript is to be written as callScript("test","case1/test").
This will transfer the execution control to the called web script and execute up to the line number specifed. The web script to be called, its location and the line number are specified as arguments.
callScriptUpto("<Web Script Name>","<Web Script Path>",Line number)
For example, assume the web script named test.wcs is present under webscripts/case1/test folder and you want to execute up to script line numbered 120, then callScriptUpto is to be written as callScriptUpto("test","case1/test",120).
|
Points to remember
|
|---|
|
|
|
This shows that after ScriptB is executed, when control returns to ScriptA the active window will not be "google" due to which setText("searchtext","web testing") will fail. This shows that callScript has been wrongly placed.
You can handle such cases by either inserting another changeURL("www.google.com") and setWindow("google") after callScript("ScriptB","ScriptB") or by inserting these at the end of ScriptB. |
|
|
|
You can set or get values in a global variable from one script to another using the setGlobal() and getGlobal() functions. You can refer to the usage of the functions in the following document.
|