PreviousSession Recording Using WinRunner 2000 and TouchPoint TogetherNext"

Chapter 30: Testing Application Output

This chapter guides you, step by step, through the process of creating a WinRunner 2000 test for an application (CICSDB2) that uses CICS and DB2.


You need to have read the chapter Start Here for the Tutorials and worked through the first session, Using Mainframe Express, and the session Session Recording, 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.

Note: If you have already worked through the TouchPoint tutorial, Year 2000 Testing, 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.


30.1 Preparation

Before you can run the CICSDB2 application, you need to carry out the following preparatory tasks:

30.1.1 Creating a Project

To create the project:

  1. Start Mainframe Express and click New on the File menu, then select Project on the New dialog box and click OK.

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

  3. Select Using this wizard as your chosen method of creating the project and click Next.

  4. Leave the default folder for the catalog (drive:\mfuser\projects\gsdemo\cicsdb2) unchanged and click Next.

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

  6. Leave the default CICS region name (CICSDB2) unchanged and click Next.

  7. Leave the default folder for the resource definition file (drive:\mfe\config) unchanged and click Next.

  8. From the pulldown list, select MCOSIT (Micro Focus CICS option SIT) for the System Initialization Table (SIT) and click Next.

  9. If you installed HCO, a dialog box is displayed asking for the name of the DB2 database. Enter SAMPLE and click Next.

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

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

30.1.2 Adding Files to the Project

To add your files to the project:

  1. Click Add Files on the Project menu.

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

  3. Select all the files in the folder, then click Add.

    The files are added to the project.

  4. Click Done.

    If you click the Copybook entry in the left-hand pane, you'll see that one of the copybooks (EMPLOY) is marked as not found. This one will be created when the .bms file is compiled.

30.1.3 Creating a DB2 Database (HCO)

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:

  1. Click HCO on the Tools menu, then click Create Database.

    The Create Database dialog box appears.

  2. Type SAMPLE in the Database field and Sample database in the Description field, then click on the dialog box.

  3. When it finishes, click OK on the message saying "Request completed", and then close the Create Database dialog box using its button.

30.1.4 Adding a Table and Data (SQL Option)

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.


  1. Select the SQL DDL/DML folder in the left-hand pane and then click EMPSALA.SQL in the right-hand pane.

  2. Click SQL For DB2 on the Tools menu, then click Execute SQL EMPSALA.SQL.

    The SQL wizard, guided by the .sql file, creates a new table and index, inserts data, and then exits.

30.1.5 Adding a Table and Data (HCO)

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.

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

  2. Click DDL FILE EXTENSION in the Settings list. You may have to pull the slider down to see it.

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

  4. Click HCO on the Tools menu, then click DDL Processor.

    The DDL Processor Tool appears.

  5. Type SAMPLE in the Database field.

  6. Click Select DDL on the File menu of the DDL Processor Tool.

  7. In the Select DDL File dialog box, open the folder \mfuser\projects\gsdemo\cicsdb2\source. Ensure the Files of Type field is set to sql Files (*.sql).

  8. Select empsala.sql and click Open.

    This sets the DDL File field to the name of this file.

  9. Click on the DDL Processor Tool.

  10. When it finishes, close the DDL Processor Tool using its button.

30.1.6 Modifying the Build Settings

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:

  1. Click Project in the left-hand pane, then click Build settings for project on the Project menu.

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

  3. Now click the COBOL tab and select COBOL for MVS as the COBOL Dialect.

  4. Click OK.

30.1.7 Building the Project

To build the project:

  1. Click Build on the Build menu, or click the Build button on the toolbar.

The build finishes with "Build finished with no errors".

30.1.8 Setting up CICS FCT and PCT Entries

Before you can run this tutorial, you need to create a number of CICS FCT and PCT entries.

30.1.8.1 Adding FCT 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 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 File Control Table (FCT) - you should see CONV and EMPL listed under File Name.


To add File Control Table entries:

  1. Click the CICS tab at the bottom of the Project View.

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

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

30.1.8.2 Adding PCT Entries


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:

  1. Click the CICS tab at the bottom of the Project View.

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

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

30.2 Before Running the Application

Before you run the application, check the following:

30.2.1 Adding CICSDB2 to the Startup List

Ensure that CICSDB2 is in the startup list:

  1. Click the CICS tab.

  2. Right-click on CICS System.

  3. Select Startup List.

  4. If CICSDB2 is not displayed in the start-up list, select it in the right-hand pane and click Add.

  5. Click OK to close the Startup List Configuration dialog box.

30.2.2 Debug Options

Check that your debug options are set correctly for running this tutorial:

  1. Select Debug from the Options menu.

  2. Ensure that Step/Run displays Start Debugging dialog is checked.

  3. Ensure that Show system programs in call stack is unchecked.

  4. Click OK.

30.2.3 Application Output Window

For the purposes of this tutorial, it is important that the Application Output Window is floating on the desktop:

  1. Select Dockable Windows from the View menu, check Application Output and click Close.

  2. Right-click within the Application Output window (if you cannot see the Application Output window click on the Application Output icon on the taskbar) and ensure that Float on desktop is checked.

  3. Close the Application Output window by clicking its button.

30.3 Running the Application

You are now ready to run the application. It is worth spending a few minutes becoming familiar with the application and what it does:

  1. Click the Run button on the toolbar. The Start Debugging dialog box is displayed.

  2. Click the CICS tab, enter an Initial TRANSID of CDB1 and click OK.

  3. 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 30-1 is displayed.



    Figure 30-1: Main Menu

  4. 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. In particular, note the format of the date.

  5. Press the F5 key to display the EMPLOYEE INFORMATION CHANGE screen. From here you can change any of the employee details. Note the format of the date of hire on this screen.

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

  7. Press F3 again to terminate the application.

  8. Press the Esc key to clear the screen.

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

  10. Close the Application Output window by clicking its button.

30.3.1 The FORMAT-DATE Section

Now that you have a general idea about the type of information that this application manipulates, it will be useful to focus on the section to be changed, FORMAT-DATE:

  1. Click the Files tab in the Project View and then double-click on the COBOL program, CDB2PRG4.CBL.

  2. Use the Find option on the Search menu to locate the FORMAT-DATE section.

  3. Set a breakpoint at the first executable line in that section (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.

  4. On the Start Debugging dialog box, select the CICS tab, enter an Initial TRANSID of CDB1 and click OK.

  5. From the main menu, press F4. The debugger gains focus when the breakpoint is hit.

  6. When the debugger is active for CDB2PRG4.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:

    In summary, then, the FORMAT-DATE section takes the employee's date of hire, converts it to Julian date form in order to calculate the day of the year on which they were hired and then formats the date for display purposes.

  7. Now zoom through the rest of the code by clicking the Run button on the toolbar.

  8. When the list of employees is displayed, press the F5 key to display the first employee's details.

  9. Press the Tab key to move to the Date of Hire field, change the date of hire to 01/01/99 (if you have already worked through the TouchPoint tutorial, Year 2000 Testing, you will not need to do this) and then press Enter (right-hand Ctrl) to save the change.

  10. Press F3 to return to the main menu.

  11. Press F3 to terminate the application.

  12. Clear the screen by pressing the Esc key.

  13. Type EXIT and press the Enter (right-hand Ctrl) key.

  14. Close the Application Output and editor windows by clicking their buttons.

30.4 Creating a WinRunner 2000 Test

To create a WinRunner 2000 test:

  1. Click the Tests tab.

  2. Select New from the Test Case menu.

  3. Select WinRunner Script and click OK.

  4. The Define Test wizard is invoked.

  5. Accept the default name for the test, Test_1, enter a description of CICSDB2 and click Next.

  6. Click New on the Define Application Start Parameters page. The Create Application Start Parameters dialog box is displayed.

  7. Enter a name of CICSDB2 and a description of CICS/DB2 Application and then click OK. The Testcase Parameters dialog box is displayed.

  8. Click the CICS tab, enter an Initial TRANSID of CDB1 and click OK.

  9. Click Next. The Select WinRunner Script page is displayed. From here you can create a new test script or select a test script from a list of all those that already exist.

  10. Select New and accept the default script name of Script_1 by clicking Next. A summary of the information you have entered is displayed. From here you can choose to record the test script now, or simply create the test and leave the recording until later.

  11. Ensure Record Script Now is checked and click Finish. WinRunner 2000 is started in record mode.

30.4.1 Recording a Test Script

Once you have created your WinRunner 2000 test and selected to record the script, WinRunner 2000 is started in record mode and the application associated with this test is started, using the specified start parameters.

  1. From the main menu press F4. Note that the date of hire for the first user is now shown as FRI 01 JAN 99.

  2. WinRunner 2000 enables you to capture all, or part of the text on a screen when you record a script. It then performs a comparision with the same area of the screen when the script is replayed. Press left-hand Ctrl and F3 - the cursor changes to a cross. This enables you to mark an area of the screen to be captured.

  3. Mark the complete list of users as shown in Figure 30-2 below. Do not include the text of the column headings or the blank space to the right of the date. When you are happy with your selection, right-click with the mouse.



    Figure 30-2: Selected Text


    Note: It is very important that the area of the screen that is captured is identical to that shown above. Do not include the blank space to the right of the date. Later in this tutorial, you are going to make a change to the application that will result in valid information being displayed to the right of the date but you do not want that information to be included in the comparison that is performed when the script is replayed, as it will automatically cause the comparison to fail.


  4. Press F3 to return to the main menu.

  5. On the WinRunner 2000 toolbar, click the Stop Recording button to stop recording.

    WinRunner 2000 has been recording every keystroke made. Your script should look similar to the one shown below (note, however, that the numbers will vary):

    #Micro Focus WinRunner 2000 Template
    type ("<kF4>");
    TE_check_text("Prt1",5,7,73,18);
    type ("<kF3>");
    

    If your script contains additional keystrokes, (for example, because you have been clicking on the online version of this Getting Started to check the instructions), edit the script so that it resembles that shown above, and then save it.

  6. Minimize WinRunner 2000 by clicking its button.

  7. Close the CICSDB2 application:

    1. Press F3 to terminate the application.

    2. Press the Esc key.

    3. Type EXIT and press the right-hand Ctrl key.

  8. Close the Application Output window by clicking its button.

30.4.2 Checking the Expected Data

You can check that the text you have captured is what you expected before you run your test.

  1. Click the Tests tab, click WinRunner in the left-hand pane and then right-click on the test you have just created (Test_1(Script_1)) and select Analyze from the context menu. The WinRunner Test Results dialog box is displayed.

  2. Double-click on the capture text event. The data that you have captured is displayed in the Terminal Display dialog box.

  3. Click OK to close the Terminal Display dialog box.

  4. Close the WinRunner Test Results dialog box by clicking on its button.

30.4.3 Running a Test

Now that the test script has been recorded, it can be played back by running the WinRunner 2000 test:

  1. Select the test (Test_1(Script_1)) by clicking on it in the right-hand pane.

  2. Select Run from the Test Case menu. The script is replayed. When it has finished, minimize WinRunner 2000 by clicking its button and then close down the CICSDB2 application:

    1. Press F3 to terminate the application.

    2. Press the Esc key.

    3. Type EXIT and press the right-hand Ctrl key.

  3. Close the Application Output window by clicking its button.

30.4.4 Analyzing the Results

Once your test has run (notice that the status is now displayed as Pass), you can analyze the results:

  1. Select the test by clicking on it in the right-hand pane.

  2. Select Analzye from the Test Case menu. The WinRunner Test Results, as shown in Figure 30-3, are displayed.



    Figure 30-3: WinRunner Test Results

  3. Notice the check text event. This is highlighted in green to show that it is successful - as you would expect, as nothing has changed yet. Double-click on the check text event to display the Terminal Display dialog box. Note that when a test is run the actual data is not recorded if it exactly matches the expected data. Click OK to close the Terminal Display dialog box.

  4. Close the WinRunner Test Results report by clicking its button.

30.5 Changing your Application

Now that the script has been replayed sucessfully you have a baseline that you can test against, so you can go ahead and make the changes to your application.

Imagine that you have been asked to update the CICSDB2 application so that the EMPLOYEE LIST screen displays, next to the employee's date of hire, the day of the year on which that employee was hired (the figure calculated and stored in WS-JULIAN-DAY by the FORMAT-DATE section).

30.5.1 Edit the Program

  1. Click the Files tab and then double-click the CDB2PRG4.CBL program to open the editor.

  2. Use the Find option on the Search menu to locate the FORMAT-DATE section.

  3. Uncomment the second MOVE statement:
    MOVE WS-JULIAN-DAY TO WORK-JUL (SUB1)

    This will cause the day of the year, held in WS-JULIAN-DAY, to be displayed on the EMPLOYEE LIST screen.

  4. Ignore the next four MOVE statements shown below:
    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 are used in the tutorial Using WinRunner 2000 and TouchPoint Together.)

  5. Finally, uncomment the statement ADD 1 TO DAY-SUB. This statement is not actually needed, uncommenting it simulates the type of error that can occur when code changes are made.

  6. Save and recompile the code by clicking the Compile button on the toolbar.

  7. Close the editor window by clicking its button.

30.5.2 Run the Test

  1. Click the Tests tab and run the Test_1(Script_1) test by selecting it in the right-hand pane of the Tests View and then selecting Run from the Test Case menu.

    As WinRunner 2000 runs, it detects a difference when the list screen is displayed. Test execution stops and the dialog box shown in Figure 30-4 is displayed:



    Figure 30-4: WinRunner 2000 Message

  2. Click the Continue button to continue running the test.

    (Clicking on the Pause button returns control to WinRunner 2000 and the cursor is positioned at the line of the script where the failure occurred. You can continue exeuction by clicking on the Run from Arrow button on the WinRunner 2000 toolbar.) You can configure the way in which WinRunner 2000 behaves when a check_text event fails via the Tests item on the Options menu. By default, test execution stops and the dialog box shown in Figure 30-4 is displayed. If the display of WinRunner messages is disabled, execution will halt only if Stop when verification fails is enabled.

  3. When the test has completed, minimize WinRunner 2000 by clicking its button and then close the application:
    1. Press F3 to terminate the application.

    2. Press the Esc key.

    3. Type EXIT and press the right-hand Ctrl key.

  4. Close the Application Output window by clicking its button.

30.5.3 Analyze the Results

The status of the Test_1(Script_1) test is now shown as Fail. To analyze the results:

  1. Select the test in the right-hand pane by clicking on it.

  2. Select Analyze from the Test Case menu. The WinRunner Test Results, as shown in Figure 30-5, are displayed.



    Figure 30-5: WinRunner Test Results

  3. The check text event is now 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.

  4. Close the Check Text Verify Viewer by clicking its button.

  5. Close the WinRunner Test Results window by clicking its button.

30.5.4 Fix the Code

  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 the Compile button on the toolbar.

  4. Close the editor window by clicking its button.

30.5.5 Re-run the Test

  1. Re-run the test by clicking on the Tests tab, selecting the test and then selecting Run from the Test Case menu.

  2. When the test has run, minimize WinRunner 2000 by clicking its button and then terminate the application:

    1. Press F3 to terminate the application.

    2. Press the Esc key.

    3. Type EXIT and press the right-hand Ctrl key.

  3. Close the Application Output window by clicking its button.

  4. Notice that the status of the test is shown as Pass again. Review the report by selecting the test and then selecting Analyze from the Test Case menu.

  5. The check text event is shown in green to signify an expected result. Double-click on the check text event - the Terminal Display dialog box containing the expected data is displayed.

Now that the code has been fixed and re-tested, the tutorial is complete.

  1. Close the Terminal Display dialog box by clicking OK.

  2. Close the WinRunner Test Results window by clicking its button.

  3. Close WinRunner 2000 by clicking its button.

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


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

PreviousSession Recording Using WinRunner 2000 and TouchPoint TogetherNext"