PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Displaying the test manager
  • Features of test manager
  • Describing a scenario
  • Characteristics of a scenario
  • Code of scenario
  • Overview
  • Displaying the test manager
  • Features of test manager
  • Describing a scenario
  • Code of scenario
  • "Before the test" process
  • "Test scenario" process
  • "After the test" process
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The test manager is used to:
  • display in the editor the list of tests (or scenarios) attached to an element.
  • configure the different tests.
  • view the status report of test execution.
Note: Use in Windows Vista: To record and replay the automatic unit tests, the UAC mechanism must be disabled.
Displaying the test manager
The list of existing automatic tests can be viewed in the "Tests" folder of "Project explorer" pane.
The different scenarios are grouped according to the element whose test is run (or according to the element that started the automatic test). For example, "TEST_WIN_Menu" groups all the test scenarios run from the "WIN_Menu" window.
To display the test manager for a specific element, use one of the following methods:
  • double-click the name of the group of tests (in the "Project explorer" pane).
  • display the element (window, class, ...) in the editor and select "Automatic tests .. Edit the tests".display the element (window, class, ...) in the editor. On the "Automatic tests" pane, in the "Tests" group, expand "New" and select "Edit the tests".
Features of test manager
The window for managing the automatic tests of an element is as follows:
From this window, you can:
  • View a summary of all tests: all you have to do is select the name of the list of tests in the tree structure displayed on the right.
  • View the characteristics of each test scenario (results and test data): all you have to do is select a scenario in the tree structure displayed on the right.
  • Start a scenario: all you have to do is select the requested scenario in the tree structure displayed on the right and select "Start" from the popup menu.
  • Display the description of a scenario: all you have to do is select a scenario in the tree structure displayed on the right and select "Description" from the popup menu.
  • Display the code of a scenario: all you have to do is select a scenario in the tree structure displayed on the right and select "Code" from the popup menu.
  • Change the status of a scenario: all you have to do is select a scenario in the tree structure displayed on the right and select "Mark the test as" or "Make the test XXXX" from the popup menu.
The test manager can also be used to create groups of tests. To assign a scenario to a group of tests, a new test must be created from this group ("Record" from the popup menu). At this time, you cannot move the tests by Drag and Drop to assign them to a group of tests.
Describing a scenario
To display the description of a test scenario:
  1. Select the scenario in the tree structure of test manager.
  2. Select "Description" from the popup menu.
The description of a test scenario is used to enter information in the different tabs:
  • "General" tab: Used to specify the name of test as well as a caption.
  • "Details" tab: Used to specify (for a window):
    • Whether the test must trigger an error if the window cannot be closed at the end of the test. When running unit tests on a window, this option is used to check whether the window is closed .
    • Whether the test must keep the window opened at the end of its execution so that other tests can be run on this window. This option allows you to link several window tests together. This option is automatically checked if another window is opened during a window test.
    • Whether the test result depends on a sequence of tests. In this case, the test cannot be run on its own.
      This tab is also used to redefine the opening parameters of the window for the test. Indeed, when running the test of a window with parameters, it may be interesting to test the opening the window by using specific parameters. The parameters specified when creating the test are indicated by default.
  • "Data" tab: Used to define the input and output parameters. These parameters are used to easily create sets of tests for example. To do so, enter the values of the different parameters in the characteristics of the scenario ("Test data" tab). Some examples for using this tab:
    • when running the test a procedure, the input parameters correspond to the expected values for the different parameters of the procedure and the output parameter corresponds to the result returned. Then, all you have to do is enter the values to test. The test allows you to check whether the value returned by the procedure corresponds to the expected value.
    • when running the test of a window, the input parameters may correspond to the test values that must be typed in the different controls.
Characteristics of a scenario
To display the characteristics of a test scenario, select the scenario in the tree structure of test manager.
The characteristics of a test scenario include:
  • the result or status report: This status report indicates whether the test was successful, its status (in maintenance, available, failed), its description and the detected errors.
    A test in construction can be enabled from the status report. All you have to do is click "End the maintenance of the test and make it available". In this case, the test is automatically run. If no error occurs, the test is available ; otherwise, the test is flagged as "Failed".
  • test data: This data is used to create a set of values that will be used for the automatic test. These values depend on the input and control parameters entered in the test description ("Data" tab). A set of given values for the test parameters correspond to an iteration. Each iteration will be checked when the test is run. The iterations can also be managed by programming (TestAddIteration).
Code of scenario
The code of test scenario can be modified. Indeed, the scenario code is written in WLanguage and it can be easily modified. To access the scenario code, select "Code" from the popup menu of the requested scenario.
Three code sections are displayed:
  • the "Before the test" process. In this process, you have the ability to localize the data that will be used for the test or to specify all the parameters required by the test.
  • the scenario of the test. You have the ability to modify the scenario code, to add operations into the test. You have the ability to use the functions specific to the automatic tests or the Emulate functions. You also have the ability to replace the values by parameters (to use a set of test data later).
  • the "After the test" process. This code allows you to check the test results (according to the data found in a reference file for example). Overall, this process allows you to close and free all the elements opened and allocated in the "Before the test" process.
Overview
The test manager is used to:
  • display in the editor the list of tests (or scenarios) attached to an element.
  • configure the different tests.
The status report of test execution is displayed in the "Results of tests" pane.
Displaying the test manager
The list of existing automatic tests can be viewed in the "Tests" folder of "Project explorer" pane.
The different scenarios are grouped according to the element whose test is run (or according to the element that started the automatic test). For example, "TEST_WIN_addressinput" groups all the test scenarios run from the "WIN_addressinput" window.
To display the test manager for a specific element, use one of the following methods:
  • double-click the name of the group of tests (in the "Project explorer" pane).
  • display the element (window, class, ...) in the editor and select "Automatic tests .. Edit the tests".display the element (window, class, ...) in the editor. On the "Automatic tests" pane, in the "Tests" group, expand "New" and select "Edit the tests".
Features of test manager
The window for managing the automatic tests of an element is as follows:
This window is used to:
  • View the summary of all the scenarios associated with the current element. In the left section of the window. The tests are classified into different categories:
    • Stand-alone tests: independent tests. For example, for a stand-alone test on a window, the window is closed at the end of test.
    • Sequenced tests: tests run one after another. For example, for sequenced tests on a window, the window remains opened at the end of first test in order to run the next test on the same window.
    • Sub-tests: tests not run directly but via EmulateWindow.
  • Display the code of a scenario: all you have to do is select a scenario in the tree structure displayed on the left. The corresponding WLanguage code is displayed in the right section of the editor.
From this window, you can:
  • Start a scenario: all you have to do is select the requested scenario in the tree structure displayed on the left and select "Start" from the popup menu.
  • Display the description of a scenario: all you have to do is select a scenario in the tree structure displayed on the left and select "Description" from the popup menu.
  • Rename or delete a scenario: all you have to do is select a scenario in the tree structure displayed on the left and select "Rename" or "Delete" from the popup menu.
  • Create a new scenario ("New scenario" from the popup menu): the created scenario is empty and the corresponding WLanguage code can be typed.
  • Create a group of tests ("New group of tests" from the popup menu): the different scenarios can be grouped in a group of tests via a "Drag and Drop" of scenario.
Different pictos allow you to find out the test status:
  • : test passed without error.
  • : test modified.
  • : test in error.
The status report of test execution is displayed in the "Results of tests" pane.
Describing a scenario
To display the description of a test scenario:
  1. Select the scenario in the tree structure of test manager.
  2. Select "Description" from the popup menu.
The description of a test scenario is used to enter information in the different tabs:
  • "General": Used to specify the name of test as well as a caption.
  • "Details": Used to specify (for a window):
    • Whether the test must trigger an error if the window cannot be closed at the end of the test. When running unit tests on a window, this option is used to check whether the window is closed. If this option is selected, the test is a stand-alone test.
    • Whether the test must keep the window opened at the end of its execution so that other tests can be run on this window. This option allows you to link several window tests together. This option is automatically checked if another window is opened during a window test. If this option is checked, the test is a sequenced test.
    • Whether the test result depends on a sequence of tests. In this case, the test cannot be run on its own. If this option is checked, the test is a sub-test.
    The "Details" tab can also be used to redefine the opening parameters of the window for test (for a stand-alone test only).
    Indeed, when running the test of a window with parameters, it may be interesting to test the opening the window by using specific parameters. The parameters specified when creating the test are indicated by default.
Code of scenario
The code of test scenario can be modified. Indeed, the scenario code is written in WLanguage and it can be easily modified. To access the scenario code, all you have to do is select a scenario in the tree structure displayed on the left. The corresponding WLanguage code is displayed in the right section of editor.
Three code sections are displayed:
  • the "Before the test" process. This process is run before the test.
  • the "Test scenario" process. This process corresponds to the code run to check the requested element.
  • the "After the test" process. This code is used to check the test results (according to the data found in a reference file for example). Overall, this process allows you to close and free all the elements opened and allocated in the "Before the test" process.

"Before the test" process

The "Before the test" process is used to:
  • locate the data that will be used for test,
  • pass the necessary parameters to the test,
  • define variables and define a set of test data (via TestAddIteration).
Example:
// -- "Before the test" process of a test on a procedure
// Two parameters have been defined in the "Test scenario" process
// Adds the test data
TestAddIteration("test@test.fr", True)
TestAddIteration("not valid", False)
TestAddIteration("", False)
TestAddIteration("test.test.test@test.fr", True)
TestAddIteration("test@test@test.fr", False)
TestAddIteration("test.fr", False)
TestAddIteration("http://www.test.fr", False)

"Test scenario" process

The "Test scenario" process corresponds to the code run by the test.
You have the ability to modify the scenario code, to add operations into the test. You have the ability to use the functions specific to the automatic tests or the Emulate functions.
You also have the ability to replace values by parameters (to use a set of test data). In this case, you have the ability to declare a procedure in this code, to specify the expected parameters.
Example 1: Script thatn is using a set of test data and a controller
In this code, the Controller1 variable is a variable defined as controller (via the <Controller> extension attribute). This controller variable can be used in the test code to check the result of a procedure for example. In our example, the code line:
Controller1 = bCheckEmail(psEmail)
runs the bCheckEmail procedure by passing the "psEmail" parameter and compares the result to the value defined for the "Controller1" variable.
// Define two parameters to create a set of test data
// The value of these parameters is defined in the "Before the test" process
PROCEDURE MyScenario(psEmail, Controller1 is boolean<controller>)
Controller1 = bCheckEmail(psEmail)
Example 2: Script that is using a set of test data and the TestVerify function
In this code, the procedure corresponding to the test expects two parameters. The test of data set is run by TestCheck.
// Define two parameters to create a set of test data
// The value of these parameters is defined in the "Before the test" process
PROCEDURE MyScenario(psEmail, Controller1 is boolean)
TestVerify(Controller1 = bCheckEmail(psEmail), "Test error for " + psEmail)

"After the test" process

The "After the test" process is used to check the test results (according to the data found in a reference file for example). Overall, this process allows you to close and free all the elements opened and allocated in the "Before the test" process.
Example: Deleting the data created during the test: this code is used to check whether the test address was created and it is used to delete it if necessary.
// Check whether the address was saved
HReadSeekFirst(ADDRESS,NAME,"TEST")
IF HFound(ADDRESS) = False THEN
// The test is not ok
TestWriteResult(twrError, "The database was not successfully updated")
ELSE
// Test ok, we can delete
TestWriteResult(twrInfo, "The database was updated")
// Delete the test address
HDelete(ADDRESS)
TestWriteResult(twrInfo, "The test address was deleted")
END
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment