|
|
|
|
|
- Overview
- How to create the test?
- To create an automated test on a procedure (or on a class method):
Automated tests of procedures and classes
The automated tests of procedure or class are used to test the different features proposed by the procedure or by the class. Remark: Use in Windows Vista (and later): To record and replay the automatic unit tests, the UAC mechanism must be disabled. To create an automated test on a procedure (or on a class method): 1st method - Display the "Project explorer" pane if necessary.
- In the "Project explorer" pane, select the name of the method or the name of the global or local procedure whose test must be run.
- Select "Unit tests .. Create a unit test" in the context menu.
- A new test scenario is automatically created. The test scenario contains the call to the function. The code required to run the test of the procedure or the test of method must be written by the developer. If the method or procedure expects parameters, you can create a test data set.
2nd method - Display the "Code" pane if necessary.
- In the "Code" pane, select the name of the method or procedure whose test must be run.
- Select "Unit tests .. Create a unit test" in the context menu.
- A new test scenario is automatically created. The test scenario contains the call to the function. The code required to run the test of the procedure or the test of method must be written by the developer. If the method or procedure expects parameters, you can create a test data set.
3rd method - Display the procedure or the method in the code editor.
- On the "Automated tests" tab, in the "Tests" group, expand "New" and select "Record a new scenario".
- A new test scenario is automatically created. The test scenario contains the call to the function. The code required to run the test of the procedure or the test of method must be written by the developer. If the method or procedure expects parameters, you can create a test data set.
4th method (only for creating the first test scenario on a procedure)- Display the procedure or the method in the code editor.
- Open the context menu of the arrow in the procedure banner and select "Create an associated test".
Remarks:- If no test scenario is associated with the procedure, the arrow will appear on a gray background . If one or more tests are associated with the procedure, the icon will appear on a green background .
- If a test has already been associated with the procedure, the context menu of the arrow allows you to:
- run all the scenarios associated with the procedure .
- see the tests associated with the procedure (i.e. the scenarios that directly or indirectly call the procedure).
- A new test scenario is automatically created. The test scenario contains the call to the function. The code required to run the test of the procedure or the test of method must be written by the developer. If the method or procedure expects parameters, you can create a test data set.
Remark: Regardless of the method used to create a test scenario, you can create a test data set. To create this data set, use TestAddIteration. For more details, see Code of scenario.
Related Examples:
|
Training (WINDEV): WD Example of unit test
[ + ] This example presents the use of the test editor included in WINDEV: - test of a window - test of a global procedure - test of a global procedure from a set of test data (available from the versions 12)
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|