| Regression and Conformance Testing |
| Session Recording | |
This chapter guides you, step by step, through the process of creating a
regression test for an application (CICSDB2) that uses CICS and
DB2 and needs to be updated to cope with the year 2000.
You need to have read the chapter Start
Here for the Tutorials and worked through the first
session, Using
Mainframe Express, and the session Regression
and Conformance Testing, before you do this session.
You need to have installed CICS Option and either SQL Option or Host
Compatibility Option to do this session. This chapter contains alternative
sections depending on whether you installed SQL Option or Host
Compatibility Option (HCO). If you are using HCO you must also have IBM's
DB2 database system installed.
Note: If you have already worked through the WinRunner 2000
tutorial, Testing
Application Output, you do not need to carry out the
steps described in the Preparation section. Instead, start
Mainframe Express, open the cicsdb2 project and go straight to the
section entitled Before Running the Application.
You need to complete the following preparatory tasks before using
TouchPoint:
- Create a project
- Add files to the project
- Create a DB2 Database and Table
- Modify the build settings
- Build the project
- Set up CICS FCT and PCT entries
To create the project:
- Start Mainframe Express, click New on the File menu,
select Project on the New dialog box and click OK.
- Enter cicsdb2 as the name of the project and change the name
of the Project Folder to drive:\mfuser\projects\gsdemo\cicsdb2,
then click Next.
- Select Using this wizard as your chosen method of creating
the project and click Next.
- Leave the default folder for the catalog (drive:\mfuser\projects\gsdemo\cicsdb2)
unchanged and click Next.
- A dialog box is displayed asking which Mainframe Express options this
project uses. It uses CICS and SQL so ensure that both these check boxes
contain check marks and click Next.
- Leave the default CICS region name (CICSDB2) unchanged and
click Next.
- Leave the default folder for the resource definition file (drive:\mfe\config)
unchanged and click Next.
- From the pulldown list, select MCOSIT (Micro Focus CICS option
SIT) for the System Initialization Table (SIT) and click Next.
- If you installed HCO, a dialog box is displayed asking for the name
of the DB2 database. Enter SAMPLE and click Next.
- If you installed SQL Option, a dialog box is displayed asking whether
the project uses a local server and whether that server should be looked
for when the project is opened and whether you should be prompted before
the server is started. Ensure that all three options are checked and
click Next.
- A summary is displayed of all the information that you have entered.
Click Finish to create the project.
If you installed SQL Option, Mainframe Express checks that an SQL server
is running on your computer. If no SQL server is running, it displays a
dialog box asking if you want to start one now. Ensure Start local
server now is checked and click OK.
To add your files to the project:
- Click Add Files on the Project menu.
- In the Add Files to Project dialog box, open the folder \mfuser\projects\gsdemo\cicsdb2\source.
- Ensure the Files of Type field is set to All Files (*.*)
(at the end of the pulldown list), select all the files in the folder,
then click Add.
The files are added to the project.
- Click Done. The files that you have added are parsed.
If you're using SQL Option, the database used in this session is
installed with Mainframe Express, so you should skip this section. If
you're using HCO you need to create the database:
- Click HCO on the Tools menu, then click Create
Database.
The Create Database dialog box appears.
- Type SAMPLE in the Database field and Sample
database in the Description field, then click
on the dialog box.
- When it finishes, click OK on the message saying "Request
completed", and then close the Create Database dialog box using its
button.
If you're using HCO, skip this section. If you're using SQL Option, you
run the SQL Wizard with the supplied DDL file to add the table and data.
Note: You only need to create this table once. If you are
re-creating this project for any reason, the table will already exist and
an error message similar to the following is displayed: Table/View "EMP_SALARY"
already exists. If this happens, click OK and then Cancel
and move on to the next section.
- Select the SQL DDL/DML folder in the left-hand pane and then
click EMPSALA.SQL in the right-hand pane.
- Click SQL For DB2 on the Tools menu, then click Execute
SQL EMPSALA.SQL.
Guided by the .sql file, the SQL Wizard creates a new table
and index, inserts data, and then exits.
If you're using SQL Option, skip this section. If you're using HCO, you
use the supplied DDL file to add the table and data.
- Click HCO on the Tools menu, then click Configuration.
The Set Defaults dialog box appears. By default HCO assumes the DDL
has an extension of .ddl, but the one supplied has an
extension of .sql. So you need to reconfigure HCO first.
- Click DDL FILE EXTENSION in the Settings list. You
may have to pull the slider down to see it.
- Type SQL in the Value field, then click Save,
click OK on the Save Changes message, then click Cancel.
You can now run the DDL.
- Click HCO on the Tools menu, then click DDL
Processor.
The DDL Processor Tool appears.
- Type SAMPLE in the Database field.
- Click Select DDL on the File menu of the DDL
Processor Tool
- In the Select DDL File dialog box, open the folder \mfuser\projects\cicsdb2\source.
Ensure the Files of Type field is set to sql Files (*.sql).
- Select EMPSALA.SQL and click Open.
This sets the DDL File field to the name of this file.
- Click
on the DDL Processor Tool.
- When it finishes, close the DDL Processor Tool using its
button.
You need to change the COBOL dialect to COBOL for MVS and the
BMS compiler needs to recognize certain features recognized by the SDF BMS
compiler on the mainframe, so:
- Click Project in the left-hand pane, then click Build
settings for project on the Project menu.
- Click the BMS tab, then click Enable SDF features to
put a check mark there.
SDF features are used in the BMS mapset used in this session.
- Now click the COBOL tab and select COBOL for MVS as
the COBOL dialect.
- Click OK.
To build the project:
- Click Build on the Build menu, or click the Build
button on the toolbar.
When the build has finished, the message Build finished with no
errors is displayed in the Mainframe Express Output window.
(If you cannot see the Output window, select Output Window
from the View menu.)
Before you can run this tutorial, you need to create a number of CICS
FCT and PCT entries.
Note: You only need to do this once. If you are re-creating the
project for any reason, the FCT entries will already exist. To check,
click the CICS tab, right-click on CICS System and select
Viewable Groups. Select CICSDB2 as the only viewable group
and click OK. Now click File Control Table (FCT) - you
should see CONV and EMPL listed under File Name.
To add File Control Table entries:
- Click the CICS tab at the bottom of the Project View.
- Click File Control Table (FCT). (If you are prompted to
change the groups being viewed, click No.) Now, right-click on
File Control Table (FCT) and select Add new FCT entry.
- Use the Browse button, ,
to select the file mfuser\projects\gsdemo\cicsdb2\data\conv.dat.
Click Open and then OK. Now use the same process to
select mfuser\projects\gsdemo\cicsdb2\data\empl.dat.
Note: You only need to do this once. If you are re-creating the
project for any reason, the PCT entries will already exist. To check,
click on the CICS tab, right-click on CICS System and
select Viewable Groups. Select CICSDB2 as the only
viewable group and click OK. Now click Program Control Table
(PCT) - you should see CDB1, CDB4, CDB5, and
CDB6 listed under Transaction ID.
To define CICS transactions for the project's programs:
- Click the CICS tab at the bottom of the Project View.
- Click Program Control Table (PCT). (If you are prompted to
change the groups being viewed, click No.) Now, right-click on
Program Control Table (PCT) and select Add new PCT entry.
- Use Add new PCT entry four times, to add the following
transactions (remember the Transaction ID is case sensitive):
Transaction ID |
Program |
Description |
CDB1 |
CDB2PRG1 |
Program to handle the
menu |
CDB4 |
CDB2PRG4 |
Program to handle
listings |
CDB5 |
CDB2PRG5 |
Program to handle updates |
CDB6 |
CDB2PRG6 |
Program to handle
displays |
Before you run the application, check the following:
- CICSDB2 is in the startup list.
- Your Application Output window is floating on the desktop.
- Your debug options are set correctly for this tutorial.
Ensure that CICSDB2 is in the startup list:
- Click the CICS tab.
- Right-click on CICS System.
- Select Startup List.
- If CICSDB2 is not displayed in the start-up list, select it
in the right-hand pane and click Add.
- Click OK to close the Startup List Configuration dialog box.
For the purposes of this tutorial, it is important that the Application
Output Window is floating on the desktop:
- Select Dockable Windows from the View menu, ensure
that Application Output is checked and click Close.
- Right-click within the Application Output window and ensure
that Float on desktop is checked. (You may have to rearrange
your desktop to be able to see the Application Output window.)
- Close the Application Output window using its
button.
Check that your debug options are set correctly for running this
tutorial:
- Select Debug from the Options menu.
- Ensure that Step/Run displays Start Debugging dialog is
checked.
- Ensure that Show system programs in call stack is unchecked.
- Click OK.
You are now ready to run the application. It is worth spending a few
minutes becoming familiar with the application and what it does:
- Click the Run button
on the toolbar. The Start Debugging dialog box is displayed.
- Click the CICS tab, enter an Initial TRANSID of CDB1
and click OK.
- A number of messages are displayed as the application logs on to the
CICS region and then the application's main menu, as shown in Figure
28-1, is displayed.
Figure 28-1: Main Menu
- Press the F4 key to display a list of employees. Note the
details that are displayed: name, social security number, office
location and date of hire. (If you have already run the WinRunner 2000
tutorial, Testing Application Output, the day of the year on
which the employee was hired is also displayed, to the right of the date
of hire.)
- Press the F5 key to display the EMPLOYEE INFORMATION CHANGE
screen. From here you can change any of the employee details. Note the
YEARS EMPLOYED field on this screen.
- Press the Tab key to move to the DATE OF HIRE field and
change the date of hire to 01/01/99 (if you have already run the
WinRunner 2000 tutorial, Testing Application Output, you will
not need to make this change). Press Enter (right-hand Ctrl)
to save the change.
- Press the F3 key to return to the main menu.
- Press F3 again to terminate the application.
- Press the Esc key to clear the screen.
- Type EXIT and press Enter (right-hand Ctrl).
- Close the Application Output window using its
button.
Now that you have a general idea about the type of information that this
application processes, it will be useful to focus on the section to be
changed, 050-COMPUTE-EMP-YEARS.
- Click the Files tab in the Project View and then double-click
on the COBOL program, Cdb2prg5.cbl.
- Use the Find option on the Search menu to locate the
050-COMPUTE-EMP-YEARS section.
- Set a breakpoint at the first executable line in that section:
MOVE ZEROS TO NO-OF-MONTHS YEARS-EMPLOYED UPDATE-EMP-YEARO
(right-click anywhere on that statement and select Set
Breakpoint). Notice that the
symbol appears alongside the line. Click the Run button
on the toolbar.
- On the Start debugging dialog box, select the CICS tab, enter
an Initial TRANSID of CDB1 and click OK.
- From the main menu, press F4.
- From the EMPLOYEE LIST screen, press F5. The debugger gains
focus when the breakpoint is hit.
- When the debugger is active for Cdb2prg5.cbl unset the
breakpoint (right-click anywhere on the statement and select Clear
Breakpoint) and step through the section (using the F10 key
or the Step button
on the toolbar) so that you can see what this section of code is doing:
- The data items NO-OF-MONTHS, YEARS-EMPLOYED and
UPDATE-EMP-YEARO are initialized.
- The current (system) date is moved to the data item, DATE-STORE.
- The number of months the employee has been employed is calculated
by using the dates held in CURR-DATE and EMPFILE-DATE-OF-HIRE.
- The result is divided by 12 (to give the number of years) and
moved to UPDATE-EMP-YEARO.
- Now zoom through the rest of the code by clicking the Run
button on the toolbar.
- When the EMPLOYEE INFORMATION CHANGE screen is displayed, press the
F3 key to display the main menu.
- Press F3 to terminate the application.
- Clear the screen by pressing the Esc key.
- Type EXIT and press the Enter (right-hand Ctrl)
key.
- Close the Application Output and editor windows using their
buttons.
DateWarp is a feature of Mainframe Express which enables you to set the
system date to the Year 2000 (or any other date) and then run your
application to see how it behaves. Note that DateWarp only affects Micro
Focus applications; it does not affect any other software on your PC.
- Select Run from the Debug menu, click the CICS
tab, enter CDB1 as the Initial TRANSID and click OK
to start the application.
- Press the F4 key to display the list of employees.
- Press the F5 key.
This displays the EMPLOYEE INFORMATION CHANGE screen which contains
the first employee's details. Note the value in the YEARS EMPLOYED
field on this screen. This is the number of years that this employee
has been with the company, calculated by subtracting the date of hire
from the system date.
- Select Break from the Debug menu and then press the
F3 key on the EMPLOYEE INFORMATION CHANGE screen. (You may have
to click the Application Output window again first.)
This invokes the debugger for the cdb2prg5 module. You may
have to rearrange the Mainframe Express desktop to be able to see the
cdb2prg5.cbl source code.
- Select DateWarp from the Debug menu and, if it is not
already selected, select January 1st 2000 as the execution date (click
the down-arrow on the list box and then click on the year to enable the
spin control. Use the spin control to move the date forward).
When you have set the date to January 1st 2000, press Return
and then click OK. This sets the system date to January 1st
2000 and enables you to test how the application will behave on that
date.
- Now press the F5 key to zoom through the program and return
to the main menu.
- Press the F4 key and then the F5 key and look at the
YEARS EMPLOYED field. The value shown is the result obtained by
subtracting the date of hire from the system date (now set to the year
2000).
Clearly, this application needs to be fixed before it will work with
Year 2000 dates.
Before going any further, reset the date and terminate the application
as follows:
- Select Break from the Debug menu and then press the
F3 key on the EMPLOYEE INFORMATION CHANGE screen to invoke the
debugger for cdb2prg5. (You may have to click on the Application
Output window again first.)
- Select DateWarp from the Debug menu and uncheck the
execution date by clicking on the check mark. This resets the system
date to today's date. The execution date is greyed out. Click OK.
- Press the F5 key to run through the program.
- From the main menu, press the F3 key to exit the application.
- Clear the screen by pressing the Esc key.
- Type EXIT and then press 3270 Enter (right-hand Ctrl)
to terminate CICS.
- Close the Application Output window using its
button.
Now that you have established that your application needs fixing, the
next stage is to isolate the code that needs to be changed and,
subsequently, tested. You also need to identify the input variables (these
are data items that affect the execution of the code fragment) and the
output variables (the contents of these can be analyzed to determine
success or failure when the fragment is executed).
- The cdb2prg5.cbl program should still be open in the editor
(you may have to rearrange your Mainframe Express desktop in order to
see it). Using the mouse, select the code in the 050-COMPUTE-EMP-YEARS
section, as shown in Figure 28-2.
Note: When you are selecting the lines of code that comprise
a fragment, you should not select any of the following at either the
start or the end of the fragment:
- Comment lines
- Section or Paragraph names
- END-IF or END-PERFORM statements
If you do select any of the above, TouchPoint displays a warning
message and prompts you to redefine the scope of the fragment.
Figure 28-2: Creating a Fragment
- Select New from the Fragment menu.
- Enter a description of COMPUTE-EMP-YEARS and click Next
- Select CURR-YYN (the data item that holds the current year,
taken from the system date, that is used by the 050-COMPUTE-EMP-YEARS
section to calculate the employee's length of service) and define it as
an input variable (click Add beneath the text Input
Variables).
- Select UPDATE-EMP-YEARO (the data item which holds the result
of the calculation performed by 050-COMPUTE-EMP-YEARS) and define it as
an output variable (click Add beneath the text Output
Variables) and then click Next. It is possible to define
multiple input and output variables, but for the purposes of this
example only the two defined above are required.
- Select Defer the creation of initial values and click Finish.
- Close the editor using its
button.
Initial values are used, when a fragment test is run, to supply values
for all the data items used within the fragment, other than the input
variable values that you supply explicitly when you create the fragment
test (see the next section for details on how to create a fragment test).
Initial values can be generated by running the application from within
Mainframe Express and recording data item values as the fragment is
encountered. (You can also create initial values manually and this may be
necessary if, for example, the execution environment or application data
is not available.)
In this example, the initial values are generated by running the
application:
- From the Project View, select the Tests tab.
- Select Initial Values from the Fragment menu and then
select Generate By Execution from the sub-menu.
- Change the name to COMPUTE-EMP-YEARS, select the fragment that you
have just created (Cdb2Prg5_1) and click OK.
- From the Testcase Parameters dialog box, click the CICS tab
and make sure CDB1 is entered as the Initial TRANSID and
then click OK to run the application. To generate initial values
for it, you need to ensure that the 050-COMPUTE-EMP-YEARS section (that
you defined as the code fragment, Cdb2Prg5_1) is executed during
this run of the application. You can do this by following these
instructions (watch the TouchPoint Output window):
- From the main menu, press the F4 key to list all the
employees.
- Press the F5 key to display the EMPLOYEE INFORMATION
CHANGE screen (and execute the 050-COMPUTE-EMP-YEARS section).
- Now press F3 to return to the main menu.
- Press F3 again to exit the application.
- Press Esc to clear the screen.
- Type EXIT and press right-hand Ctrl to exit the
CICS region.
A message box is displayed informing you that the Cdb2prg5_1
fragment has been encountered (and therefore the initial values for it
have been generated). Click OK to close the message box.
When you generate initial values for a fragment, a value is stored for
each data item within the fragment. These values are used, when a fragment
test is run, for every data item for which you have not explicitly
supplied a value (see below for details on creating a fragment test).
To check the intial values that have been generated by running the
application:
- In the left-hand pane, right-click on COMPUTE-EMP-YEARS and
select Edit from the context menu. The Initial Values dialog
box, shown in Figure 28-3 is displayed.
Figure 28-3: Checking the Initial Values
- Initial values are captured immediately before the fragment is
executed. A fragment may be executed several times when an application
is run but the initial values are captured only once, the first time the
fragment is encountered. Note the values of CURR-DATE (the
system date), CURR-YYN (this has been defined as an input
variable and so the initial value shown here will be overwritten by the
value(s) that you supply when you create the fragment test) and EMPFILE-DOH-YYN
(this is the employee's date of hire). Note that because initial values
are captured immediately before the fragment is executed for the first
time, EMPFILE-DOH-YYN holds the date of hire of the first
employee to appear on the EMPLOYEE INFORMATION CHANGE screen. Because
EMPFILE-DOH-YYN has not been defined as an input variable, this
initial value will be used each time the fragment is executed when the
fragment test is run. (You can alter the value of an initial value by
double-clicking on it and entering the new value.)
- Close the Initial Values dialog box by clicking OK.
When you create a fragment test, you can supply one or more values for
each of the input variables that you defined for the code fragment. The
fragment is executed once for each value that you supply. All values other
than those that you supply are taken from the nominated set of initial
values. Each iteration is executed independently of the others as the
initial values are reloaded each time, refreshing the values of the data
items in the fragment.
You can supply a date, or a range of dates, as input variable values.
TouchPoint's date feature is particularly powerful as it allows you to
roll a range of dates over the Year 2000 (whereas a standard range would
not work, for example, for values of 95 to 05).
As well as input variable values, you can specify baseline values by
editing the baseline and switching on baseline comparison. This enables
you to supply "correct" values that each iteration is tested
against. You can use this feature to perform compliance testing, as this
example shows:
- Select New from the Test Case menu.
- Select Fragment and click OK.
- Accept the default name (FragmentTest_1) for the test, select
the Cdb2prg5_1 fragment and click Next.
- Select COMPUTE-EMP-YEARS as the initial values to be used for
the test and click Finish. The fragment test worksheet is
displayed, with the initial value of the input variable shown in the
first row.
- Right-click on the cell which represents CURR-YYN for
iteration 1 and click Date to display the Date Entry dialog box
(illustrated in Figure 28-4).
Select the following:
Type: Range
Format: YY
Start date: 01 January 1999
End date: 01 January 2005
Step size: 1 year
Notes:
- The date format that you select must match the picture clause of
the data item for which you are specifying it (in this case, CURR-YYN).
You cannot, for example, specify a date format of YYMMDD if the
picture clause of the data item is PIC 99.
- To specify the year, click the down-arrow, click on the year that
is displayed and then use the spin control to edit it. When you have
the year you want, press the Return key and then click on
the month. Select January from the drop-down list and then
click on the number 1 to select it (you may have to do this
twice).
Figure 28-4: Specifying a Range of Dates
- Click OK.
This specifies that the test will be run 7 times - once for each
year between 1999 and 2005. The values that you have specified will be
used for the input variable CURR-YYN, but all the other data
items within the fragment (including EMPFILE-DOH-YYN) will use
the same initial value each time.
- Right-click in the Compare Baseline column and select Edit
baseline. The dialog box shown in Figure 28-5 is displayed.
Figure 28-5: Editing Baseline Values
- Double-click in the UPDATE-EMP-YEARO column for iteration 1,
enter 00 and press Return. Repeat the process for iterations 2
to 7, entering values of 01 to 06. When you have entered a value for
each iteration, click OK.
- To close the fragment test worksheet, click OK on the Define
Fragment Test Iteration Values dialog box.
Now that you have created your test, you can run it. The fragment will
be executed once for each input variable value that you have supplied:
- You have supplied 7 input variable values such that the Cdb2prg5_1
fragment (the 050-COMPUTE-EMP-YEARS section) will be executed 7 times
using a different value of CURR-YYN each time. Those values, 99
to 05, represent the years 1999 to 2005.
- Each time the fragment is executed the value of the data item EMPFILE-DOH-YYN
is taken from the COMPUTE-EMP-YEARS set of initial values and so
it is always 99.
- Each time the fragment is executed the value of the output variable,
UPDATE-EMP-YEARO is recorded and compared to the baseline value
that you specified for that iteration. (Knowledge of the application and
its data has enabled you to supply the expected baseline value for each
iteration using the Edit Baseline function.)
So, in this example, cdb2prg5.cbl is tested to see whether,
given current year values of 1999 to 2005, and a consistent employee date
of hire of 1999, the value output in UPDATE-EMP-YEARO matches the "expected"
baseline values of 0 to 6.
Because you have supplied baseline values manually you do not need to
use the Record function to record a baseline.
To run the test:
- Select the test in the right-hand pane. (You may have to click Project
in the left-hand pane before you can see the test.)
- Select Run from the Test Case menu.
In the Mainframe Express Output window (click the Build
tab), a message is displayed for each iteration of the test. Finally, a
message is displayed informing you that the test has been executed
successfully. The status of the test is shown as Fail.
You can use TouchPoint to analyze the test results:
- Select Analyze from the Test Case menu. (Make sure
the test is selected in the right-hand pane.)
- The status of each iteration is displayed in the left-hand pane:
- You can select each iteration in turn by clicking on it and view the
value used for the input variable in the top right-hand pane and the
values recorded for the output variable (or in this case, supplied by
using the Edit Baseline feature) and generated by running the
test in the bottom right-hand pane.
- As you can see, all iterations that use a current year of 2000 or
later have failed. When you have finished analyzing the results, click
the Close button.
The next stage is to fix the code. In this example, this is done by
adding some Year 2000 windowing code:
- Click the Files tab and then double-click on cdb2prg5.cbl
to open the editor.
- In the 050-COMPUTE-EMP-YEARS section, comment out the first COMPUTE
statement (note that this statement runs over three lines, comment them
all out) and then uncomment the PERFORM Y2K-WINDOW statement.
- Click the Compile button
on the toolbar to compile the program.
- Close the editor window using its
button.
You can run a test many times (with more fixes applied as necessary),
and analyze the results each time.
- Click the Tests tab.
- In the right-hand pane, select the test, FragmentTest_1.
- Select Run from the Test Case menu.
In the Mainframe Express Output window (click the Build
tab), a message is displayed as each iteration is executed. Finally, the
message Test FragmentTest_1 completed is displayed. Notice that
the status of the test is now shown as Pass.
You can use the Analyze option to analyze the new results.
- Right-click on the test and select Analyze from the context
menu.
- Select each iteration in turn (from the left-hand pane) and analyze
how each input value (top right-hand pane) affects the output variable
value (bottom right-hand pane). Note that each iteration now has a
status of Pass.
- Click the Close button.
Now run the application once more, just to confirm that everything still
works as it did before.
- Select Start Debugging from the Debug menu.
- Click the CICS tab, enter an Initial TRANSID of CDB1
and click OK.
- Select Run from the Debug menu.
- From the main menu, press F4.
- Press F5.
The YEARS EMPLOYED field should contain the correct value.
You have now completed this tutorial. Press F3 to return to the
main menu and then again to exit the application. Press Esc to
clear the screen, type EXIT and press right-hand Ctrl to
terminate CICS. To stop the SQL server, press the Esc key from the
XDB-SERVER main menu.
Close the project. If you want to take a break before going on to the
next session, you can close Mainframe Express.
Return to the Tutorials
Map in the chapter Start Here for the Tutorials and
choose which session to go on to next, depending on your interests.
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
| Regression and Conformance Testing |
| Session Recording | |