Ile Procedures
Ile Procedures
Ile Procedures
Acceptance
Requirements
Test
System
Analysis Test
Integration
Design
Test
http://www.softwarearchitect.biz/chapter10/chapter10.htm
Agenda
What is an ILE Procedure?
How Procedures Are Used by Unit Test Scripts
Starting a Unit Test Script
Writing the Test Script
Formatting the Output
Test Script Results
Reusing Unit Test Scripts
Compiling and Running the Test Script
Runtime Interactions Between Modules
Compiling For Production
Conclusion
What is an ILE Procedure?
Notice that the procedure name, the parameter, the expected result and the actual
result are shown. With these values you can determine if your procedure passed or
failed the unit test.
Formatting the Output
Example 1
The printTest procedure requires four parameters.
Store the name of the procedure you are testing in the procName variable.
Set inputValue equal to the character values of the input parameters.
Set plannedResult to the character value of the value(s) you expect.
Obtain the procedure result(s) by calling it as shown on line 22. If the results are
numeric, convert to character using the built-in function %char (see line 23).
Call the printTest procedure passing the parameters in the order shown.
Formatting the Output
Example 2
The format of this line is similar but, it is produced a little differently. The next slide
will show a more convenient way to produce this format.
Formatting the Output
Example 2
The printTest procedure will accept literals for the first three parameters.
You can pass literal values for procedure name, input value(s) and planned
result. Instead of coding seven lines to print a unit test, we can get the same
result coding only four lines!
Literal values won’t work as the actual result - that would be cheating!
Call your procedure passing the input value, convert the output if necessary
and pass actualResult as the fourth parameter. (Lines 29 - 32.)
Formatting the Output
Example 3
printFormattedTest can also be called with four parameters and omitting the use of
the append… functions. Literals may be used for the procedure name, input value(s)
and expected result(s).
Writing the Test Script - Finish
End your test script by closing the print file with a call to endTest. Then set on
indicator LR and return.
Test Script Results
Resulting output from the four tests run by the test script.
Reusing Unit Test Scripts
UNITTEST
callp startTest 1
startTest
2
3
getCheckDigit result = getCheckDigit(100)
4
5
callp printTest printTest
6
7
callp endTest endTest
8
Compiling For Production
We do not want to add test
objects to the production
environment.