Você está na página 1de 28

Chapter 6

How to test a CICS program

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 1

Objectives
1. Describe the four types of testing mentioned in this chapter. 2. Explain how using top-down testing can improve the testing process. 3. Given the specifications for a CICS program, develop a test plan for it. 4. Use the CEMT transaction to perform the following functions: a. update the working copy of a CICS program b. open and close a file c. disable and enable a transaction or program 5. Use the CECI transaction to execute CICS commands interactively.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 2

Four common types of testing


Test Unit test Concurrency test Description The program is tested on its own to insure that it works according to the program specifications. The program is tested simultaneously at several terminals to make sure that multiple executions of the same program dont interfere with one another. The program is tested in context with other programs in the application. Testing that was originally done against the program is repeated when the program undergoes maintenance.

Integration test Regression test

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 3

What you need to know about the testing environment


Is there a testing environment separate from the production environment? Do you need to use generic transaction identifiers and program names within the testing environment? Are there test versions of the files you need to test your program? Are testing and debugging aids like the CEMT, CECI, and CEDF transactions available? Are any third-party tools for testing and debugging available? Does your shop have a procedure for managing program testing and program versions?

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 4

An OS/390 procedure for preparing a CICS program


//MM01CMPL JOB 36512,'R.MENENDEZ',MSGCLASS=X,CLASS=C, // REGION=4M,NOTIFY=MM01 //CICSCMP EXEC DFHYITVL, // PARM.COB='OFFSET,MAP', // PROGLIB='MM.MM01CICS.CICSTS13.LOADLIB' //TRN.SYSIN DD DSN=MM01.CICS.SOURCE(CUSTMNT1),DISP=SHR //COB.SYSLIB DD // DD DSN=MM01.CICS.COPYLIB,DISP=SHR //LKED.SYSIN DD * NAME CUSTMNT1(R) /*

Description
The JCL for preparing a CICS program executes a cataloged procedure named DFHYITVL. This procedure contains steps to translate (TRN), compile (COB), and link-edit (LKED) the program.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 5

Guidelines for preparing a top-down test plan


Test just a few modules at a time, but test all of the processing in each module. Test the critical modules of the program early in the plan, and test the remaining modules in whatever sequence you prefer. Keep the test data to a minimum in the early test phases.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 6

A top-down test plan for the customer maintenance program


Phase 1 Modules 0000, 1500 Test Enter all valid and invalid attention keys from the key map to be sure that theyre processed properly and that the key map is displayed properly Enter valid and invalid customer numbers and action codes to be sure theyre received and edited properly Enter valid key map entries and all valid and invalid attention keys from the data map to be sure that theyre processed properly and that the data map is displayed properly; enter invalid customer numbers to be sure theyre handled properly Enter valid key map and data map entries for an add operation to be sure that the record is written properly Enter valid key map and data map entries for a change operation to be sure that the record is rewritten properly Enter valid key map and data map entries for a delete operation to be sure that the record is deleted

2 3

1000, 1100, 1200 1300, 1400

4 5 6

2000, 2100, 2300 3000, 3100, 3200 4000, 4100

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 7

Guidelines for coding and testing from the top down


To start, code the Identification Division and as much of the Data Division as is needed for the first phase of testing. Then, code the Procedure Division modules that are going to be tested. When you add new modules to the Procedure Division for the next phase of testing, add any code in the Data Division thats required to support those modules. If you include a Perform statement for a module that isnt implemented yet, you can comment out the Perform statement or code a program stub for it. You can also comment out other statements you dont want executed.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 8

Guidelines for coding a program stub


If a program stub doesnt have to do anything for the successful completion of a test run, the module can consist of the paragraph name only. If necessary, a program stub can simulate the function that will be done by that module. For example, an input stub can simulate the reading of one or more records.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 9

A processing stub that consists of only the paragraph name


1300-GET-CUSTOMER-RECORD. *

An input stub that simulates the reading of a record


1100-READ-CUSTOMER-RECORD. * MOVE MOVE MOVE MOVE MOVE MOVE * 'JOHN' 'DOE' '100 MAIN STREET' 'ANYWHERE' 'CA' '99999' TO TO TO TO TO TO CM-FIRST-NAME. CM-LAST-NAME. CM-ADDRESS. CM-CITY. CM-STATE. CM-ZIP-CODE.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 10

What to check for on the screen


Are all the headings and captions placed correctly? Are the user instructions displayed properly? Is there any garbage on the screen? Are all words spelled correctly? Do all the fields have the correct attributes? Is the cursor in the correct initial location? Does the cursor move correctly from field to field?

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 11

What to check for as you enter valid data


Are all the program screens displayed in the correct sequence? Do all the attention keys work correctly? Are the user messages always correct? Are the functions of all attention keys indicated? Does the program properly acknowledge the receipt of valid data? Are work fields properly cleared after each valid transaction? Are control totals accumulated properly? Are files updated properly?

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 12

What to check for as you enter invalid data


Does each case of invalid data for each field yield an appropriate error message? Do look-up routines work properly? Is the field in error highlighted? Is the cursor positioned at the field in error? When you correct the error, do the error message and highlighting go away? Does the program post transactions even though errors are detected? Does the program detect all possible cross-validation errors? Does the program properly detect and highlight multiple entry errors?

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 13

The customer master file as displayed by DITTO

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 14

How to view program results


To make sure that a program that updates records in a file works correctly, you need to compare the data in the file before the program is run with the data in the file after the program is run. To display the contents of a file on the screen, you can use a utility program called DITTO. You can use DITTO to modify, print, and copy data in both VSAM and non-VSAM files. To print the contents of a file, you can use a VSAM utility program called IDCAMS.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 15

The syntax of the CESN command


CESN [USER=username] [PS=password]

The syntax of the CESF command


CESF [LOGOFF | GOODNIGHT]

A CESN command that includes a user-id and password


CESN USER=RAUL,PS=MMA2000

A typical CESF command


CESF LOGOFF

Description
The CESN command signs you on to CICS. The CESF command signs you off. Depending on how CICS is set up, you may or may not need to use these commands.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 16

The syntax of the CEMT commands commonly used for testing


To force a new copy of a program
CEMT SET PROGRAM(name) NEWCOPY

To open or close a file


CEMT SET FILE(name) {OPEN | CLOSE}

To disable or enable a program or transaction


CEMT SET PROGRAM(name) {DISABLED | ENABLED} CEMT SET TRANSACTION(name) {DISABLED | ENABLED}

To check on the status of a file, program, or transaction


CEMT INQUIRE {FILE(name) | PROGRAM(name) | TRANSACTION(name)}

Description
To use CEMT, type the CEMT trans-id followed by a CEMT command. You can also enter CEMT without a command and CEMT will help you construct the command.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 17

Examples of the CEMT commands


A command that refreshes CICSs copy of the CUSTMNT1 program
CEMT SET PROGRAM(CUSTMNT1) NEWCOPY

A command that closes the customer master file


CEMT S FI(CUSTMST) CL

A command that disables the MNT1 transaction


CEMT S TRA(MNT1) D

A command that displays the status of all files that start with the letter C
CEMT I FI(C*)

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 18

The syntax of the CECI and CECS commands


{CECI | CECS} [CICS-command]

The CECI start-up panel

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 19

A CECI command that reads a record from the customer master file
CECI READ FILE(CUSTMAS) RIDFLD(123456)

Description
To invoke CECI, enter the CECI trans-id followed by a CICS command. You can also enter CECI without a CICS command and CECI will list the commands you can issue. Before CECI executes a command, it checks the syntax of the command. You can use the CECS trans-id to restrict the functionality of CECI so that it only checks the syntax of the command you specify. When you issue a command from CECI, you dont have to bracket the command with EXEC CICS and END-EXEC, and you dont have to use apostrophes to identify literals.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 20

Screen 1
To add variables for use within CECI, press PF5 from the start-up panel to display the Variables panel. Then, enter a name (starting with an ampersand (&)) and length for each variable below the pre-defined variables and press the Enter key.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 21

Screen 2
CECI confirms that the variables have been defined. Then, you can enter initial values for the variables and press the Enter key to return to the start-up screen.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 22

Screen 3
Enter the READ command you want to execute and then press the Enter key. (If a syntax error is detected, you can press PF9 to display the error message. Then, you can correct the command and issue it again.)

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 23

Screen 4
Before it executes the command, CECI verifies the option values. To execute the command, press the Enter key.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 24

Screen 5
CECI executes the READ command and displays the result.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 25

Screen 6
To update the record just read, type a REWRITE command over the READ command and press the Enter key.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 26

Screen 7
When CECI confirms the command, change the data to be rewritten and press the Enter key. CECI confirms the command again. Press the Enter key to execute the command.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 27

Screen 8
CECI executes the REWRITE command and displays the results. To end CECI, press PF3.

CICS, C6

2001, Mike Murach & Associates, Inc.

Slide 28

Você também pode gostar