ON (Reserved word) In french: SUR
The ON keyword is used exclusively in the automated tests generated by WINDEV and WEBDEV. This keyword is used to avoid splitting the test scenarios (1 per window) when recording an automated test. ON indicates the window "on" which the specified actions will be applied. Automatically generated tests contain the ON keyword. The entire code with all sequences and all actions is visible in the same scenario: this results in better readability
EmulateMenu("_Menu", "Managing_the_contributors2") EmulateMouse(WIN_CRM, dmLeftButtonDown, 354, 34) // Scenario to run when opening the WIN_ManageContributor window ON WIN_ManageContributor DO EmulateMouse(WIN_ManageContributor.EDT_NAME, dmLeftButtonDown, 66, 33) EmulateMouse(WIN_ManageContributor.EDT_NAME, dmLeftButtonUp, 62, 5) EmulateInput(WIN_ManageContributor.EDT_NAME, "b") EmulateMouse(WIN_ManageContributor.LSV_CONTRIBUTOR, dmLeftDoubleClick, 165, 61) // Scenario to run when opening the WIN_AddContributor window ON WIN_AddContributor DO EmulateMouse(WIN_AddContributor.Title, dmLeftButtonUp, 112, -11) EmulateMouse(WIN_AddContributor.BTN_CANCEL, dmLeftClick, 46, 14) END EmulateMouse(WIN_ManageContributor.BTN_CANCEL, dmLeftClick, 43, 9) END
Syntax
Code to run during the window test Hide the details
ON <Window name> DO <Code to run> END
<Window name>: Name of the window opened by the automated test. <Code to run>: Code to run in the window opened by the automated test.
Code to run during the test of a dialog box or the test of a function that returns no result Hide the details
ON <Function name> RETURN
<WLanguage function name>: Name of WLanguage function to run. For example, to prevent from opening the dialog boxes of Error:
Code to run during the test of a WLanguage function that returns a value Hide the details
ON <WLanguage function name> RETURN <Value>
<WLanguage function name>: Name of WLanguage function to run. For example:
ON fImageSelect RETURN fExeDir() + "\ExampleImage.jpg"
In this case, the function test is not run and fExeDir() + "\ExampleImage.jpg" is returned to the scenario. <Value>: Value that will be returned to the scenario. Remarks Position of ON block The ON block must be placed just after the call to the WLanguage functions that trigger the ON. For example, the following code does not operate:
// Clicks the "Export to text format" option EmulateMouse("WIN_Main.LAYOUT_EXPORT[1].BTN_EXPORT_TEXT", emLeftClick, 173, 37) // Defines a test file let sExportFile = fTempFile() + ".TXT" ON fSelect RETURN sExportFile
You must use the following code:
// Defines a test file let sExportFile = fTempFile() + ".TXT" // Clicks the "Export to text format" option EmulateMouse("WIN_Main.LAYOUT_EXPORT[1].BTN_EXPORT_TEXT", emLeftClick, 173, 37) ON fSelect RETURN sExportFile
This page is also available for…
|
|
|
|