ON (Reserved word) In french: SUR
The ON keyword is exclusively used in the automatic tests generated by WINDEV, WEBDEV and WINDEV Mobile. This keyword is used to avoid splitting the test scenarios (1 per window) when recording an automatic test. The ON keyword indicates the window "onto" which the specified actions will be applied. From version 14, the tests that have been automatically generated contain the ON keyword. The entire code with all sequences and all actions is visible in the same scenario: the readability is improved.
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 window opened by the automatic test. <Code to run>: Code to run in the window opened by the automatic 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
<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 <Name of WLanguage function> RESULT <Value>
<Name of WLanguage function>: Name of WLanguage function to run. For example:
ON fImageSelect RESULT 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 RESULT 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 RESULT sExportFile
This page is also available for…
|
|
|