Fragments | Tests |
This chapter describes the initial values that are used in fragment testing and explains how you can use TouchPoint to generate them.
Note: You cannot use initial values for application testing.
If you are going to run a fragment test, where a single fragment is executed in isolation from the remainder of the application, TouchPoint needs to be able to set meaningful values for all of the data items used within the fragment. To this end, it uses a set of initial values.
Initial values are used to ensure that all the data items used within a fragment are in their correct initial state when fragment execution occurs, so a value must be held for each data item referenced within the fragment.
Imagine that you have defined a fragment which manipulates twenty data items. You may have defined three of them as input variables (enabling you to specify values for them when you create the fragment test) but you will also need sensible values for the remaining data items so that you can execute the fragment without having to run the application up to the point at which the fragment starts.
You can create more than one set of initial values for the same fragment. For example, you may have an application which performs certain functions each time it is used but performs additional functions on the last day of each month. You can generate two sets of initial values: one set for an ordinary day and one set for the last day of the month.
You can generate initial values:
Initial values are generated, for one or more fragments, by running the entire application and recording, when execution reaches the start of the fragment, the value of every data item that it uses.
TouchPoint is used to execute the application on the workstation and a snapshot of the data items used by the fragment is taken as each fragment starting point is reached. Note that a fragment may be executed more than once but the initial values are recorded only once, the first time the fragment is encountered and before it is actually executed.
You can define default values to be used for all data items. These default values can be specified as:
You can specify that any existing VALUE clauses will be used. In this case, any defaults you have defined are overwritten by the value specified in the VALUE clause.
Finally, you can manually edit the value of any, or all, of the data items used by the fragment. Manual edits will overwrite both default values and VALUE clause values.
You can import initial values from a .bsl file. A .bsl file is a text file that has been created by using TouchPoint to export initial values.
The initial values are used for every variable that is not defined as an input variable, and also for input variables whenever a value is not explicitly defined for them.
Once you have generated a set of initial values you can, if you wish, edit those values.
To generate initial values by running the application, select Initial Values from the Fragment menu and then select Generate By Execution. The dialog box shown in Figure 21-1 is displayed.
Figure 21-1: Generating Initial Values by Running the
Application
Enter a name and a description. You should make these as meaningful as possible.
You can select one or more fragments by clicking on them (hold down the Ctrl key to select multiple fragments), or you can select them all by clicking on Select All. When you have selected the fragments that you want, click OK. The Testcase Parameters dialog box shown in Figure 21-2 is displayed.
Figure 21-2: Running the Application
Click on the appropriate tab, enter any start parameters that are required and then click OK to run the application. As the application runs, values are recorded for every data item within the fragment(s) you have specified. Note that the value is recorded only once, the first time that the fragment is encountered.
As the application runs, a message is displayed in the Build view of the Output window whenever a fragment is encountered.
When the application terminates, a message is displayed listing the fragments that have been encountered (and for which initial values have been generated), as illustrated in Figure 21-3.
Figure 21-3: Initial Value Generation
You can select Initial Values and then Stop Generation from the Fragment menu in order to halt the generation of initial values.
This may prove useful if, for example, you are running a large application and know that all the fragments for which you require initial values have already been encountered.
You can only define initial values manually for a single fragment at a time. To define initial values manually, click on the Tests tab and, in the left-hand pane, select the fragment for which you want to define the initial values. Select Initial Values from the Fragment menu and then select Manual Definition. The dialog box shown in Figure 21-4 is displayed.
Figure 21-4: Manual Definition of Initial Values
Enter a name and a description. You should make these as meaningful as possible.
You can specify any of the following:
When you click OK, the dialog box shown in Figure 21-5 is displayed.
Figure 21-5: Generating Initial Values Manually
To enter a value for a data item, double-click on its current value or select the data item by clicking on it and then click Edit Value. Any values that you enter will overwrite any default values that you have specified.
When you have finished entering values, click OK.
You can import a set of initial values to be used with a fragment by selecting the fragment and selecting Initial Values and then Import from the Fragment menu.
You import initial values from a .bsl file, an ordinary text file that has been created by using TouchPoint to export initial values.
To export a set of initial values:
This creates an initial values file containing a value for each data item used by the fragment. By default, the file is created in the project directory.
You can edit a set of initial values:
To remove the association between a fragment and a set of initial values:
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Fragments | Tests |