Chapter 33: Using WinRunner 2000 and TouchPoint 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.


33.1 Overview

This chapter demonstrates how you can use WinRunner 2000 and TouchPoint together to perform comprehensive tests on your application by:

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.

33.2 Define the Code to be Changed as a Fragment

As the first step you need to identify the code to be changed, and subsequently tested, and define it as a fragment.

  1. Start Mainframe Express and open the CICSDB2 project.

  2. Click the Files tab, and then double-click on CDB2PRG4.CBL to open it in the editor.

  3. 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

  4. Right-click with the mouse and select Create Code Fragment from the context menu.

  5. Accept the default fragment name of CDB2PRG4_1, enter a description of FORMAT-DATE and click Next.

  6. 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.

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

  8. Click Next to display the Initial Value Creation dialog box.

  9. Ensure Defer the creation of initial values is selected and click Finish.

  10. Close the editor by clicking its button.

33.3 Generate Initial Values

Having defined the fragment, you need to generate some initial values that can be used when testing it.

  1. Click the Tests tab on the Project View.

  2. Select Initial Values from the Fragment menu and then click Generate by Execution.

  3. Enter a name of FORMAT-DATE, select the CDB2PRG4_1 fragment and then click OK. The Testcase Parameters dialog box is displayed.

  4. Click the CICS tab, select CDB1 as the Initial TRANSID and click OK. The CICSDB2 application is started and its main menu is displayed.

  5. 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:

    1. Press the F4 key to display the list of employees. This executes the CDB2PRG4_1 fragment.

    2. Press the F3 key to return to the main menu.

    3. Press the F3 key again to terminate the application.

    4. Press the Esc key to clear the screen.

    5. Type EXIT and press Enter (right-hand Ctrl).

  6. 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.

33.4 Create Fragment Tests

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.

33.4.1 Year_2000 Test

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:

  1. Click New on the Test Case menu.

  2. Select Fragment and click OK.

  3. 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.

  4. Select the initial values generated earlier (FORMAT-DATE) and click Finish. The fragment test worksheet is displayed.

  5. 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
    

  6. 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.

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

  8. Double-click in the Compare Baseline column to toggle baseline comparison off.

  9. Click OK to close the fragment test worksheet.

33.4.2 Leap_Years Test

Now create a second fragment test to test the CDB2PRG4_1 fragment with leap year dates:

  1. Click New on the Test Case menu.

  2. Select Fragment and click OK.

  3. 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.

  4. Select the initial values generated earlier (FORMAT-DATE) and click Finish. The fragment test worksheet is displayed.

  5. Right-click on the WS-CALC-DATEN column for iteration one and select the Date function from the context menu.

  6. 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.

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

  8. Double-click in the Compare Baseline column to toggle baseline comparison off.

  9. Click OK to close the fragment test worksheet.

33.5 Run the Fragment Tests

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:

  1. Click the Tests tab.

  2. 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.

  3. 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.

33.6 Create an Application Test

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:

  1. Click New on the Test Case menu.

  2. Select Application and click OK. The Define Application Test wizard is invoked.

  3. Accept the default name of ApplicationTest_1, enter a description of CICSDB2 and click Next. The Define Application Start Parameters page is displayed.

  4. 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.)

  5. Click Next. The Select Fragments page is displayed.

  6. Select the CDB2PRG4_1 fragment by clicking on it and click Next. The Select WinRunner Script page is displayed.

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

  8. Check that all the details are correct and then click Finish.

33.6.1 Record the Application Test

Record the application test so that you have a baseline to test against.

  1. 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.

  2. Close the CICSDB2 application:

    1. Press the F3 key to terminate the application.

    2. Press the Esc key to clear the screen.

    3. 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.

33.7 Make your Application Changes

Now that you have created both fragment and application tests, you can make the changes to your application.

  1. 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.

  2. 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.

  3. 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.

  4. Save and compile the program by clicking on the Compile button and then close the editor window by clicking on its button.

33.8 Run the Fragment Tests

Now run the two fragment tests to check that your code still works with Year 2000 and leap year dates.

  1. 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).

  2. 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 33-1: CICSDB2 Project Tests

33.9 Analyze the Results

You can use the analyze function to analyze the test results.

  1. 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.

33.10 Fix the Code

The fragment tests have shown that your application changes have introduced regression errors.

  1. 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.

  2. Recompile the program by clicking the Compile button on the toolbar.

  3. Close the editor window by clicking on its button.

33.11 Run the Fragment Tests Again

  1. 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).

  2. 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.

33.12 Analyze the Test Results

  1. 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.

  2. 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.)

  3. Close the Analyze Fragment Test dialog box by clicking on the Close button.

33.13 Run the Application Test

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.

  1. Right-click on the application test in the right-hand pane and then select Run from the context menu.

  2. 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.

  3. When the script completes, minimize WinRunner 2000 by clicking on its Minimize button and then close the CICSDB2 application:

    1. Press the F3 key to terminate the application.

    2. Press the Esc key to clear the screen.

    3. Type EXIT and press Enter (right-hand Ctrl).

    The status of ApplicationTest_1 has changed to Fail.

  4. 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 33-2: Analyze Application Test

    If the application test has failed, then, the error must have been found by WinRunner 2000.

  5. Click the Analyze Script button. WinRunner 2000 displays the WinRunner Test Results dialog box.

  6. 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.

  7. Close the Check Text Verify Viewer by clicking on its button.

  8. Close the WinRunner Test Results window by clicking on its button.

  9. Close the Analyze Application Test dialog box by clicking OK.

33.14 Fix the Code Again

  1. Click the Files tab and double-click on CDB2PRG4.CBL to edit it.

  2. Within the FORMAT-DATE section, comment out the second, additonal, ADD 1 TO DAY-SUB statement.

  3. Re-compile the source code by clicking on the Compile button on the toolbar.

  4. Close the editor window by clicking on its button.

33.15 Re-run the Application Test

  1. 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:

    1. Press the F3 key to terminate the application.

    2. Press the Esc key to clear the screen.

    3. Type EXIT and press Enter (right-hand Ctrl).

    The status of ApplicationTest_1 has changed to Pass.

  2. 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 33-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.

33.16 Before Continuing

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.


Comments on the books? Click Send Us Comments.


Copyright © 2001 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.