Fast black-box testing by calling JavaScript functions
Traditionally, to test a function you have to:
Code a driver function
Set alerts to see the return value, and
Remove all this extra code when the testing is done.
Antechinus unique design makes function-testing effortless. It allows you to simply call any JavaScript function that is available to the Web page, specify the parameters (if any), and observe the return value. This one-of-a-kind feature makes testing a breeze. |
The following example illustrates how to call functions from within the Editor:
In the Project pane, open the Solutions / Cookies solution and double-click Cookies.htm and Cookies.js to open them in the Editor. ( Cookies are stored in a text file and used by your browser. They consist of name=value pairs, with some optional information - expiration time, path, domain, and the "secure" keyword. Cookies.js has functions that allow you to store and retrieve cookies. )
Click on the Cookies.htm tab to make it the active window, and select View / Internal Page Viewer from the menu to view the page
Click on the Cookies.js pane to make it the active window, then click on the SetCookie() function to select it, and right-click to display the pop-up menu
Select the Call option. The Call JavaScript function dialog appears. The SetCookie () function is selected, and the parameter list is displayed.
Type the name and the value parameters like in the example above. You can leave the remaining parameters (expires, path, domain, and secure) empty. Click OK.
The function was invoked, and the cookie was stored. The function has no return value, which shows in the status line.
To verify that the cookie was stored, now call the GetCookie () function, and specify "JavaScript Editor Site" as the name of the cookie. GetCookie (name) returns the cookie value, or null if the cookie has not been set, and shows it in the status line.
You can also open the Call JavaScript function dialog by clicking on the button. The dialog maintains the history of all the calls that you made to the given page, allowing you to re-use the calls.
|