- Running the automated tests of an executable from WINDEV
- Running the automated tests of an executable without WINDEV
- Command line
- Recording an automated test of an executable without WINDEV
- "Automated test" event of the project
Automated tests on an executable
WINDEV proposes to run the different project tests directly on the corresponding executable. This allows you to run the test of an executable in real deployment conditions.
The principle is straightforward:
- A test robot (WDAutomate.exe) that operates with its own framework allows you to run the requested executable.
- The executable to test must be used in the same conditions as the ones experienced by the end users (including, if necessary, the access to the databases used or to an equivalent test database, the framework used, ...).
- To run the different tests, the executable whose test must be run loads a specific library containing the tests.
- The tests are run and the result is saved in the Control Centers. The result can be displayed:
- from the test robot (by selecting the executable and the test library).
- from WINDEV (for the project version used to create the executable).
Remark: The automated tests do not operate on a non-interactive TSE session.
Running the automated tests of an executable from WINDEV
To directly run the automated tests on an executable from WINDEV:
- Create the executable: expand in the quick access buttons and select "Generate the Windows executable (32 bits)" for example.
- Generate test library: on the "Automated tests" tab, in the "Automated test" group, click "Generate library". The test library has the following format: TEST_<ProjectName>.WDL. This library is created in the "Data of automated tests" subdirectory of the project.
- Run the tests on the executable: on the "Automated tests" tab, in the "Automated test" group, click "Start the automated test". In this window, you must select:
- The relevant product (WINDEV).
- The executable whose test must be run.
- The test library to use.
- The command line (if necessary).
- The tests to run.
Remark: If the executable contains internal components, the automated tests of these internal components also appear in the list of tests that can be executed.
- Click the "Run the tests" button. The tests are automatically run and the result is displayed in the test robot.
Running the automated tests of an executable without WINDEV
The automated tests of a WINDEV executable can be run without the corresponding product being installed on the current computer. However, some files are required:
- Files required to start the test robot:
- Files required to save the results of tests: Data files of Control Centers. At least one Control Center must be installed on the computer.
The data files of Control Centers must be the ones used on the development computer (to be able to see the result of the tests). Several cases may occur:
- if the Control Centers use a Client/Server database, the data of the Control centers is shared between the computers.
- if the Control Centers use a HFSQL Classic database in network, the data of Control Centers is found in a shared directory.
- Executable to test with its framework (and the accesses required for the test).
- Test library and test data (the "Data of automated tests" subdirectory of the project must be copied to the computer)
The result of the automated tests can be directly viewed in WINDEV: to do so, open the project corresponding to the executable.
To test an executable created with a previous version of WINDEV, the test robot must have access to the WD280Test.DLL library that corresponds to the version of the executable.
Therefore, the WD280Test.DLL library must be copied in the same location as WDAutomate.exe.
There are two syntax options to use WDAutomate in command line:
- Syntax 1: Passing the executable and the test library directly:
WDAutomate [EXE=<Name and path of the executable to be tested>]
[/WDL=<Name and path of the automated test library>]
- Syntax 2: Using a script file:
In this case, <Script file path> corresponds to a text file in XML format with the following content:
WDAutomate [/SCRIPT=<Script file path>]
<EXE>Name and path of the executable to test</EXE>
<LC>Command line to pass to the executable</LC>
<WDL>Name and path of the automated test library</WDL>
In this case, the result of the scripts will be in a <Results> tag in the script file.
Recording an automated test of an executable without WINDEV
The recording of a test scenario can be enabled by an entry in the .wx file of the application.
Reminder: The .wx file must be used to configure some features of the executable. It must have the same name as the .EXE file and be located in the same directory. Its extension is.wx (uppercase or lowercase characters).
The following section must be added to the .wx file:
FILE=<name and path of the test scenario file to record
(the extension of this file must be .wsct)>
DLLPATH=<path of the DLLs required to record the scenario>
This method can be used if the executable does not use the same version of the DLLs as the test robot (WDAutomate.exe) and therefore the two applications cannot be found in the same directory.
Two additional DLLs are required to record the test: wd280test.dll and wdtest.dll.
"Automated test" event of the project
WINDEV allows you to enable (or not) the "Automated test" event of the project. On the "Automated tests" tab, click
in the "Tests" group and select:
- "Enable the code of automatic test for the project".
- "Disable the code of automatic test for the project".
In the case of an automated test, this event is run before the project initialization code. This code us used to process some special cases where the automated test may be locked: opening a window in the project initialization code (settings, license agreement, custom login window, etc.).
The event "Automated test" of project allows you to use EmulateWindow
to validate the window for example.