Chapter 6
How to test a CICS program
Objectives 1. Describe Describe the the four four t!es t!es of testin" testin" #entio #entioned ned in in this this cha!ter. cha!ter. 2. $%!lain $%!lain ho ho usin" usin" to!'don to!'don testin" testin" can can i#!ro(e i#!ro(e the testi testin" n" !rocess. ). *i(en the s!ecifi s!ecification cationss for a CICS CICS !ro"ra#, !ro"ra#, de(elo! de(elo! a test test !lan !lan for it. +. se the C$MC$M- transac transaction tion to !e !e rfor# the folloin" folloin" functions functions a. u!date u!date the orkin" orkin" co! of a CICS CICS !ro"ra !ro"ra# # b. o!en and close a file c. disabl disablee and and enab enable le a transa transacti ction on or !ro"r !ro"ra# a# /. se the C$CI C$CI transac transaction tion to e%ecute e%ecute CICS co##ands co##ands interac interacti(el ti(el. .
Four common types of testing Test
Description
nit test
-he !ro"ra# is tested on its on to insure that it orks accordin" to the !ro"ra# s!ecifications.
Concurrenc test
-he !ro"ra# is tested si#ultaneousl at se(eral ter#inals to #ake sure that #ulti!le e%ecutions of the sa#e !ro"ra# dont interfere ith one another.
Inte"ration test
-he !ro"ra# is tested in conte%t ith other !ro"ra#s in the a!!lication.
e"ression test
-estin" that as ori"inall done a"ainst the !ro"ra# is re!eated hen the !ro"ra# under"oes #aintenance.
What you nee to !now about the testing environment •
•
• •
•
Is there a testin" en(iron#ent se!arate fro# the !roduction en(iron#ent Do ou need to use "eneric transaction identifiers and !ro"ra# na#es ithin the testin" en(iron#ent Are there test (ersions of the files ou need to test our !ro"ra# Are testin" and debu""in" aids like the C$M-, C$CI, and C$D3 transactions a(ailable Are an third'!art tools for testin" and debu""in" a(ailable Does our sho! ha(e a !rocedure for #ana"in" !ro"ra# testin" and !ro"ra# (ersions
"n OS#$%& proceure for preparing a CICS program //MM01CMPL JOB 36512,'R.MENENDEZ',MSGCLASS=X,CLASS=C, // REGION=4M,NOTI!=MM01 //CICSCMP EXEC D"!IT#L, // PARM.COB='OSET,MAP', // PROGLIB='MM.MM01CICS.CICSTS13.LOADLIB' //TRN.S!SIN DD DSN=MM01.CICS.SO$RCE%C$STMNT1&,DISP=S"R //COB.S!SLIB DD // DD DSN=MM01.CICS.COP!LIB,DISP=S"R //LED.S!SIN DD ( NAME C$STMNT1%R& /(
Description •
-he 4C5 for !re!arin" a CICS !ro"ra# e%ecutes a catalo"ed !rocedure na#ed D37I-85. -his !rocedure contains ste!s to translate 9-:;, co#!ile 9C<=;, and link'edit 95>$D; the !ro"ra#.
'uie(ines for preparing a top)own test p(an •
•
•
CICS, C6
-est ?ust a fe #odules at a ti#e, but test all of the !rocessin" in each #odule. -est the critical #odules of the !ro"ra# earl in the !lan, and test the re#ainin" #odules in hate(er se@uence ou !refer. >ee! the test data to a #ini#u# in the earl test !hases.
© 2001, Mike Murach & Associates, Inc.
Slide 6
" top)own test p(an for the customer maintenance program *hase
+ou(es
Test
1
0000, 1/00
$nter all (alid and in(alid attention kes fro# the ke #a! to be sure that there !rocessed !ro!erl and that the ke #a! is dis!laed !ro!erl
2
1000, 1100, 1200
$nter (alid and in(alid custo#er nu#bers and action codes to be sure there recei(ed and edited !ro!erl
)
1)00, 1+00
$nter (alid ke #a! entries and all (alid and in(alid attention kes fro# the data #a! to be sure that there !rocessed !ro!erl and that the data #a! is dis!laed !ro!erlB enter in(alid custo#er nu#bers to be sure there handled !ro!erl
+
2000, 2100, 2)00
$nter (alid ke #a! and data #a! entries for an add o!eration to be sure that the record is ritten !ro!erl
/
)000, )100, )200
$nter (alid ke #a! and data #a! entries for a chan"e o!eration to be sure that the record is reritten !ro!erl
6
+000, +100
$nter (alid ke #a! and data #a! entries for a delete o!eration to be sure that the record is deleted
'uie(ines for coing an testing from the top own •
•
•
-o start, code the Identification Di(ision and as #uch of the Data Di(ision as is needed for the first !hase of testin". -hen, code the rocedure Di(ision #odules that are "oin" to be tested. Ehen ou add ne #odules to the rocedure Di(ision for the ne%t !hase of testin", add an code in the Data Di(ision thats re@uired to su!!ort those #odules. If ou include a erfor# state#ent for a #odule that isnt i#!le#ented et, ou can co##ent out the erfor# state#ent or code a !ro"ra# stub for it. 7ou can also co##ent out other state#ents ou dont ant e%ecuted.
'uie(ines for coing a program stub •
•
If a !ro"ra# stub doesnt ha(e to do anthin" for the successful co#!letion of a test run, the #odule can consist of the !ara"ra!h na#e onl. If necessar, a !ro"ra# stub can si#ulate the function that ill be done b that #odule. 3or e%a#!le, an in!ut stub can si#ulate the readin" of one or #ore records.
" processing stub that consists of on(y the paragraph name 1300)GET)C$STOMER)RECORD. (
"n input stub that simu(ates the reaing of a recor 1100)READ)C$STOMER)RECORD. ( MO#E 'JO"N' MO#E 'DOE' MO#E '100 MAIN STREET' MO#E 'AN!*"ERE' MO#E 'CA' MO#E '+++++' (
TO TO TO TO TO TO
CM)IRST)NAME. CM)LAST)NAME. CM)ADDRESS. CM)CIT!. CM)STATE. CM)ZIP)CODE.
What to chec! for on the screen •
Are all the headin"s and ca!tions !laced correctl
•
Are the user instructions dis!laed !ro!erl
•
Is there an "arba"e on the screen
•
Are all ords s!elled correctl
•
Do all the fields ha(e the correct attributes
•
Is the cursor in the correct initial location
•
Does the cursor #o(e correctl fro# field to field
What to chec! for as you enter va(i ata •
Are all the !ro"ra# screens dis!laed in the correct se@uence
•
Do all the attention kes ork correctl
•
Are the user #essa"es alas correct
•
Are the functions of all attention kes indicated
•
Does the !ro"ra# !ro!erl acknoled"e the recei!t of (alid data
•
Are ork fields !ro!erl cleared after each (alid transaction
•
Are control totals accu#ulated !ro!erl
•
Are files u!dated !ro!erl
What to chec! for as you enter inva(i ata •
Does each case of in(alid data for each field ield an a!!ro!riate error #essa"e
•
Do look'u! routines ork !ro!erl
•
Is the field in error hi"hli"hted
•
Is the cursor !ositioned at the field in error
•
•
• •
Ehen ou correct the error, do the error #essa"e and hi"hli"htin" "o aa Does the !ro"ra# !ost transactions e(en thou"h errors are detected Does the !ro"ra# detect all !ossible cross'(alidation errors Does the !ro"ra# !ro!erl detect and hi"hli"ht #ulti!le entr errors
The customer master fi(e as isp(aye by DITTO
How to view program resu(ts •
•
•
-o #ake sure that a !ro"ra# that u!dates records in a file orks correctl, ou need to co#!are the data in the file before the !ro"ra# is run ith the data in the file after the !ro"ra# is run. -o dis!la the contents of a file on the screen, ou can use a utilit !ro"ra# called DITTO. 7ou can use DI--< to #odif, !rint, and co! data in both 8SAM and non'8SAM files. -o !rint the contents of a file, ou can use a 8SAM utilit !ro"ra# called IDCAMS .
The synta, of the C-S. comman CESN $SER=- PS=78
The synta, of the C-SF comman CES LOGO 9 GOODNIG"T
" C-S. comman that inc(ues a user)i an passwor CESN $SER=RA$L,PS=MMA2000
" typica( C-SF comman CES LOGO
Description •
-he C$S: co##and si"ns ou on to CICS. -he C$S3 co##and si"ns ou off. De!endin" on ho CICS is set u!, ou #a or #a not need to use these co##ands.
The synta, of the C-+T commans common(y use for testing To force a new copy of a program CEMT SET PROGRAM%& NE*COP!
To open or c(ose a fi(e CEMT SET ILE%& :OPEN 9 CLOSE;
To isab(e or enab(e a program or transaction CEMT SET PROGRAM%& :DISABLED 9 ENABLED; CEMT SET TRANSACTION%& :DISABLED 9 ENABLED;
To chec! on the status of a fi(e/ program/ or transaction CEMT IN<$IRE :ILE%& 9 PR OGRAM%& 9 TRA NSACTION%&;
Description •
-o use C$M-, t!e the C$M- trans'id folloed b a C$Mco##and. 7ou can also enter C$M- ithout a co##and and C$M- ill hel! ou construct the co##and.
-,amp(es of the C-+T commans " comman that refreshes CICS0s copy of the C1ST+.T2 program CEMT SET PROGRAM%C$STMNT1& NE*COP!
" comman that c(oses the customer master fi(e CEMT S I%C$STMST& CL
" comman that isab(es the +.T2 transaction CEMT S TRA%MNT1& D
" comman that isp(ays the status of a(( fi(es that start with the (etter C CEMT I I%C(&
The synta, of the C-CI an C-CS commans :CECI 9 CECS; CICS)78
The C-CI start)up pane(
" C-CI comman that reas a recor from the customer master fi(e CECI READ ILE%C$STMAS& RIDLD%123456&
Description •
•
•
•
-o in(oke C$CI, enter the C$CI trans'id folloed b a CICS co##and. 7ou can also enter C$CI ithout a CICS co##and and C$CI ill list the co##ands ou can issue. =efore C$CI e%ecutes a co##and, it checks the snta% of the co##and. 7ou can use the C$CS trans'id to restrict the functionalit of C$CI so that it onl checks the snta% of the co##and ou s!ecif. Ehen ou issue a co##and fro# C$CI, ou dont ha(e to bracket the co##and ith $G$C CICS and $:D'$G$C, and ou dont ha(e to use a!ostro!hes to identif literals.
Screen 2 -o add (ariables for use ithin C$CI, !ress 3/ fro# the start'u! !anel to dis!la the 8ariables !anel. -hen, enter a na#e 9startin" ith an a#!ersand 9&;; and len"th for each (ariable belo the !re'defined (ariables and !ress the $nter ke.
Screen 3 C$CI confir#s that the (ariables ha(e been defined. -hen, ou can enter initial (alues for the (ariables and !ress the $nter ke to return to the start'u! screen.
Screen $ $nter the $AD co##and ou ant to e%ecute and then !ress the $nter ke. 9If a snta% error is detected, ou can !ress 3F to dis!la the error #essa"e. -hen, ou can correct the co##and and issue it a"ain.;
Screen 4 =efore it e%ecutes the co##and, C$CI (erifies the o!tion (alues. -o e%ecute the co##and, !ress the $nter ke.
Screen 5 C$CI e%ecutes the $AD co##and and dis!las the result.
Screen 6 -o u!date the record ?ust read, t!e a $EI-$ co##and o(er the $AD co##and and !ress the $nter ke.
Screen Ehen C$CI confir#s the co##and, chan"e the data to be reritten and !ress the $nter ke. C$CI confir#s the co##and a"ain. ress the $nter ke to e%ecute the co##and.
Screen 7 C$CI e%ecutes the $EI-$ co##and and dis!las the results. -o end C$CI, !ress 3).