PreviousFragments TestsNext"

Chapter 21: Initial Values

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.


21.1 Overview

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:

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.

21.2 Generating Initial Values by Running the Application

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

21.2.1 Stop 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.

21.3 Defining Initial Values Manually

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.

21.4 Importing Initial Values

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.

21.5 Exporting Initial Values

To export a set of initial values:

  1. Click on the Tests tab and select the initial values by clicking on them.

  2. Select Initial Values and then Export from the Fragment menu.

  3. Specify the name of the file (this will be given a .bsl extension by default) and click OK.

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.

21.6 Editing Initial Values

You can edit a set of initial values:

  1. Click on the Tests tab and select the initial values by clicking on them.

  2. Select Initial Values and then Edit from the Fragment menu.

  3. Double-click on a value (or select the data item by clicking on it and then click Edit Value) to alter it.

  4. When your edits are complete, click OK.

21.7 Removing Initial Values

To remove the association between a fragment and a set of initial values:

  1. Click on the Tests tab and select the initial values by clicking on them.

  2. Select Initial Values and then Remove from the Fragment menu.

  3. Click Yes to confirm that you want to remove the 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.

PreviousFragments TestsNext"