| Testing Application Output |
| Introduction to Using Options Together | |
This tutorial is based around the sample application, CICSDB2,
used in the WinRunner 2000 and TouchPoint tutorials. It is therefore
assumed that you have already completed those tutorials and that you have
created a Mainframe Express project for CICSDB2 as described in
those chapters.
You need to have read the chapter Start
Here for the Tutorials and worked through the first
session, Using
Mainframe Express, and the sessions Regression
and Conformance Testing, Year
2000 Testing, Session
Recording and Testing
Application Output, before you do this session.
You need to have installed WinRunner 2000, 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.
This chapter demonstrates how you can use WinRunner 2000 and TouchPoint
together to perform comprehensive tests on your application by:
- Creating fragment tests that test the individual application modules
that you have changed.
- Creating an application test, driven by a WinRunner 2000 script,
which tests the application as a whole.
While working through the WinRunner 2000 tutorial, Testing
Application Output, you made a change to the FORMAT-DATE
section in the CDB2PRG4.CBL module so that the day of the year on
which an employee was hired is displayed on the EMPLOYEE INFORMATION
CHANGE screen, next to the date of hire. In this tutorial the FORMAT-DATE
section is further enhanced so that this information is displayed in
parentheses.
As the first step you need to identify the code to be changed, and
subsequently tested, and define it as a fragment.
- Start Mainframe Express and open the CICSDB2 project.
- Click the Files tab, and then double-click on CDB2PRG4.CBL
to open it in the editor.
- Select the first executable line of the FORMAT-DATE section:
COMPUTE WS-NUMBER-OF-DAYS
and then, holding down the left-hand mouse button, extend the
selection to the last executable line:
MOVE WS-CALC-YY TO DF-YY
- Right-click with the mouse and select Create Code Fragment
from the context menu.
- Accept the default fragment name of CDB2PRG4_1, enter a
description of FORMAT-DATE and click Next.
- WS-CALC-DATEN is the data item that holds the employee's date
of hire, in its original form, at the start of the FORMAT-DATE
section. Click WS-CALC-DATEN and then the Add button
beneath Input Variables to define it as an input variable.
- WS-JULIAN-DAY is the data item that holds the number of days
since the start of the year at the end of the FORMAT-DATE
section. Click WS-JULIAN-DAY and then the Add button
beneath Output Variables to define it as an output variable.
- Click Next to display the Initial Value Creation dialog box.
- Ensure Defer the creation of initial values is selected and
click Finish.
- Close the editor by clicking its
button.
Having defined the fragment, you need to generate some initial values
that can be used when testing it.
- Click the Tests tab on the Project View.
- Select Initial Values from the Fragment menu and then
click Generate by Execution.
- Enter a name of FORMAT-DATE, select the CDB2PRG4_1
fragment and then click OK. The Testcase Parameters dialog box
is displayed.
- Click the CICS tab, select CDB1 as the Initial
TRANSID and click OK. The CICSDB2 application is
started and its main menu is displayed.
- To generate initial values for it, you need to ensure that the CDB2PRG4_1
fragment (the FORMAT-DATE section) is executed. You can do that
by following the instructions below:
- Press the F4 key to display the list of employees. This
executes the CDB2PRG4_1 fragment.
- Press the F3 key to return to the main menu.
- Press the F3 key again to terminate the application.
- Press the Esc key to clear the screen.
- Type EXIT and press Enter (right-hand Ctrl).
- A message is displayed confirming that the fragment has been
encountered during execution (and therefore initial values have been
generated for it). Click OK to close the message box.
Now that you have defined the code to be changed as a fragment and
generated some initial values for it, the next step is to create one or
more fragment tests that will capture any regression errors that your
changes may introduce.
In this tutorial, two fragment tests are created, Year_2000 and
Leap_Years. These tests work by specifying validation criteria for
the WS-JULIAN-DAY output variable.
The first test, Year_2000, tests the FORMAT-DATE section
over the days between 25 December 1999 and 7 January 2000.
To create a fragment test:
- Click New on the Test Case menu.
- Select Fragment and click OK.
- Enter a test name of Year_2000, add a description of Year
2000 Test, select the CDB2PRG4_1 fragment from the drop-down
list and click Next.
- Select the initial values generated earlier (FORMAT-DATE) and
click Finish. The fragment test worksheet is displayed.
- Right-click in the WS-CALC-DATEN column for iteration 1,
select the Date function from the context menu and specify:
Type: Range
Format: YYYYMMDD
Start date: 25th December 1999
End date: 7th January 2000
Step size: 1 day
- Click OK. This tests the FORMAT-DATE section using as input
the days between Christmas day 1999 and the end of the first working
week in the Year 2000.
- Double-click in the Condition column for iteration 1 and
type:
WS-JULIAN-DAY < 366 AND > 0
Click OK. This tests that the value held in WS-JULIAN-DAY is
valid by specifying that it should always be less than 366 and greater
than 0.
- Double-click in the Compare Baseline column to toggle
baseline comparison off.
- Click OK to close the fragment test worksheet.
Now create a second fragment test to test the CDB2PRG4_1
fragment with leap year dates:
- Click New on the Test Case menu.
- Select Fragment and click OK.
- Enter a name of "Leap_Years", a description of Leap
Year Test, select the CDB2PRG4_1 fragment from the drop-down
list and click Next.
- Select the initial values generated earlier (FORMAT-DATE) and
click Finish. The fragment test worksheet is displayed.
- Right-click on the WS-CALC-DATEN column for iteration one and
select the Date function from the context menu.
- Specify:
Type: Range
Format: YYYYMMDD
Start date: 29th February 1976
End date: 29th February 2004
Step size: 4 years
and click
OK. This tests the FORMAT-DATE section with an input
date of 29 February for every leap year between 1976 and 2004.
- Double-click in the Condition column and enter:
WS-JULIAN-DAY = 60
and click OK. As February 29th should always be the 60th day
of a leap year, this tests that the value of WS-JULIAN-DAY is
correct.
- Double-click in the Compare Baseline column to toggle
baseline comparison off.
- Click OK to close the fragment test worksheet.
Having created your fragment tests you can run them to ensure that the
code is working correctly, before you make any changes to it. (As no
baseline comparison is required, you do not need to record a baseline.)
To run the tests:
- Click the Tests tab.
- Right-click on the Year_2000 test in the right-hand pane (you
may need to click Closed Code Fragments first) and select Run
from the context menu. Click the Build tab on the Mainframe
Express Output Window to see a message displayed as each
iteration is executed. The fragment is executed 14 times. When the test
is complete its status is changed to Pass in the Project View.
- Now run the Leap_Years test. Again, a message is displayed in
the Output Window as each iteration is executed and, when the
test is complete, its status is updated to Pass in the Project
View.
Note: The information that is displayed in the Mainframe Express
Output window as a test is run is configurable via the Tests
item on the Options menu.
Both tests should pass as no changes have been made to the application
yet.
As well as fragment tests that test the individual fragments that have
changed, you can use TouchPoint to create application tests which perform
tests on the entire application, including any fragments you have changed.
And you can use WinRunner 2000 to automate the running of an application
test, as well as to test your application data.
To create an application test:
- Click New on the Test Case menu.
- Select Application and click OK. The Define
Application Test wizard is invoked.
- Accept the default name of ApplicationTest_1, enter a
description of CICSDB2 and click Next. The Define
Application Start Parameters page is displayed.
- Click the Select Existing button, select CICSDB2 and
click OK. (These are the application start parameters that you
created when working through the WinRunner 2000 tutorial, Testing
Application Output.)
- Click Next. The Select Fragments page is displayed.
- Select the CDB2PRG4_1 fragment by clicking on it and click
Next. The Select WinRunner Script page is displayed.
- Check Use WinRunner Script, click Select and then
click on the List button. This displays a list of existing
WinRunner 2000 scripts. Select the Script_1 script and click
OK. (This is the WinRunner 2000 script that you created when
working through the WinRunner 2000 tutorial, Testing Application
Output. It displays the EMPLOYEE LIST screen and performs a TE_check_text.)
Click Next to display the Summary page.
- Check that all the details are correct and then click Finish.
Record the application test so that you have a baseline to test against.
- Right-click on the application test, ApplicationTest_1, in
the right-hand pane (you may have to click Open Code Fragments
first) and select Record from the context menu. The CICSDB2
application is started using the CICSDB2 application start
parameters and the WinRunner 2000 script is run. When it is complete,
minimize WinRunner 2000 by clicking on its
button.
- Close the CICSDB2 application:
- Press the F3 key to terminate the application.
- Press the Esc key to clear the screen.
- Type EXIT and press right-hand Ctrl.
The status of ApplicationTest_1 is shown as "-" - this
indicates that it has been recorded but not yet run.
Now that you have created both fragment and application tests, you can
make the changes to your application.
- Click the Files tab and then double-click CDB2PRG4.CBL
to open the editor and find the line:
MOVE WS-JUL-DDD TO WS-JULIAN-DAY
Comment it out, and comment out the line below it:
MOVE WS-JULIAN-DAY TO WORK-JUL (SUB1)
This removes the two statements that resulted in the day of the year
being displayed on the EMPLOYEE INFORMATION CHANGE screen.
- Uncomment the next four MOVE statements:
MOVE '(' TO WORK-JUL (SUB1) (1:1)
MOVE WS-JUL-DATEN (4:3) TO WS-JULIAN-DAY
MOVE WS-JULIAN-DAY TO WORK-JUL (SUB1) (2:3)
MOVE ')' TO WORK-JUL (SUB1) (5:1)
These statements move the day of the year into WS-JULIAN-DAY
and format it for display.
- Uncomment the next executable line:
ADD 1 TO DAY-SUB
This statement is not needed, uncommenting it simulates the type of
error that can occur when code changes are made.
- Save and compile the program by clicking on the Compile
button and then close
the editor window by clicking on its
button.
Now run the two fragment tests to check that your code still works with
Year 2000 and leap year dates.
- Click the Tests tab, click Project to display all the
tests for the project and then select both fragment tests (Year_2000
and Leap_Years) in the right-hand pane (hold down the Ctrl
key to select more than one test).
- Right-click on either of the tests and select Run from the
context menu. In the Output Window you should see that each
iteration has been executed. In the Tests tab the status of the
tests has changed to Fail.
Figure 31-1: CICSDB2 Project Tests
You can use the analyze function to analyze the test results.
- Select each test in turn (you can only analyze one test at a time),
right-click on it and select Analyze from the context menu.
Each iteration of the Year_2000 test fails because the values
output in WS-JULIAN-DAY do not meet the validation criterion
specified. The same is true for the Leap_Years test.
The fragment tests have shown that your application changes have
introduced regression errors.
- Click the Files tab and then double-click CDB2PRG4.CBL
to open the editor and find the line:
MOVE WS-JUL-DATEN (4:3)TO WS-JULIAN-DAY
Change it to:
MOVE WS-JUL-DATEN (5:3)TO WS-JULIAN-DAY
The day of the year starts at the fifth byte of WS-JULIAN-DAY,
(YYYYDDD), not the fourth byte.
- Recompile the program by clicking the Compile button
on the toolbar.
- Close the editor window by clicking on its
button.
- Click the Tests tab and select both fragment tests in the
right-hand pane (hold down the Ctrl key to select more than one
test).
- Select Run from the Test Case menu. In the Output
Window you should see that each iteration has been executed. In the
Tests tab the status of the tests has changed to Pass.
- You can only analyze one test at a time so if both tests are
highlighted you must select just one by clicking on it. Now select each
test in turn by right-clicking on it and then select Analyze
from the context menu.
- Select each input variable and analyze how it affects the output
variable. (For the Year_2000 test, WS-JULIAN-DAY holds
the correct value and so meets the validation criterion specified (that
is, it is always more than 0 and less than 366). For the Leap_Years
test, WS-JULIAN-DAY is always equal to 60.)
- Close the Analyze Fragment Test dialog box by clicking on the Close
button.
Now that your fragment tests have shown that the individual modules are
working correctly again, you can run your application test to ensure that
the application as a whole has not been adversely affected.
- Right-click on the application test in the right-hand pane and then
select Run from the context menu.
- The CICSDB2 application is started and the WinRunner 2000
script is run. At the point where the check_text event is
performed, however, script execution is halted and a Micro Focus
WinRunner 2000 message is displayed: Mismatch in Prt1. This
indicates that the check_text event has failed. Click Continue.
- When the script completes, minimize WinRunner 2000 by clicking on its
Minimize button
and then close the CICSDB2 application:
- Press the F3 key to terminate the application.
- Press the Esc key to clear the screen.
- Type EXIT and press Enter (right-hand Ctrl).
The status of ApplicationTest_1 has changed to Fail.
- Right-click on the application test and select Analyze from
the context menu. The Analyze Application Test dialog box shows that the
CDB2PRG4_1 fragment was encountered 12 times and that each time
the value of the output variable matched the recorded baseline value.
For each iteration, therefore, a status of Pass is displayed.
Figure 31-2: Analyze Application Test
If the application test has failed, then, the error must have been
found by WinRunner 2000.
- Click the Analyze Script button. WinRunner 2000 displays the
WinRunner Test Results dialog box.
- The check text event is shown in red to indicate failure.
Double-click on it to display the Check Text Verify Viewer. You
may need to maximize this window to be able to do a full comparison
between the expected and actual data. The Check Text Verify Viewer
is used to compare the expected data with the actual results. At first
glance the data may appear identical but look closely at the day of the
week - in each case the actual data differs by one day. This is the
result of our superfluous
ADD 1 TO DAY-SUB
statement.
- Close the Check Text Verify Viewer by clicking on its
button.
- Close the WinRunner Test Results window by clicking on its
button.
- Close the Analyze Application Test dialog box by clicking OK.
- Click the Files tab and double-click on CDB2PRG4.CBL
to edit it.
- Within the FORMAT-DATE section, comment out the second,
additonal,
ADD 1 TO DAY-SUB
statement.
- Re-compile the source code by clicking on the Compile button
on the toolbar.
- Close the editor window by clicking on its
button.
- Click the Tests tab, right-click on the application test and
select Run from the context menu. The WinRunner 2000 script runs
the CICSDB2 application. When it has terminated, minimize
WinRunner 2000 by clicking on its
button and close the CICSDB2 application:
- Press the F3 key to terminate the application.
- Press the Esc key to clear the screen.
- Type EXIT and press Enter (right-hand Ctrl).
The status of ApplicationTest_1 has changed to Pass.
- Right-click on ApplicationTest_1 and select Analyze
from the context menu. Again, the Analyze Application Test dialog box
shows that all the output variable values matched the recorded baseline
values but now, when you click the Analyze Script button, the
WinRunner Test Results dialog box shows that the check text
event was successful.
Figure 31-3: Project Tests
Note: As you move the cursor over the right-hand pane,
information is displayed about each test. For a fragment test, the name of
the initial values used is displayed. For an application test, the name of
the application start parameters and, if applicable, WinRunnner 2000
script used by the test is displayed. For a WinRunner 2000 test, the name
of the WinRunner 2000 script and, if applicable, any application start
parameters used by the test is displayed.
Your program changes are now complete and this tutorial has demonstrated
how you can use TouchPoint and WinRunner 2000 together to perform
comprehensive fragment and application testing on your application.
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.
| Testing Application Output |
| Introduction to Using Options Together | |