-
Notifications
You must be signed in to change notification settings - Fork 28
Mock a CALL statement and provide fake results
dakaa16 edited this page May 6, 2022
·
9 revisions
Home -> User Guide -> Common Test Case Patterns ->
TESTSUITE 'Grade 91-100 = A, 81-90 = B, 71-80 = C, 65-70 = D, below 65 = F'
TESTCASE 'Grade 91 is A'
MOCK CALL 'CALCGRADES'
MOVE 91 TO CALC-AVG-GRADE
END-MOCK
PERFORM ASSIGN-LETTER-GRADE
EXPECT WS-LETTER-GRADE TO BE 'A'
TESTCASE "Call mock is performed"
MOCK CALL 'PROG3' USING
BY CONTENT VALUE-1,
BY VALUE VALUE-2,
VALUE-3
MOVE "content" TO VALUE-1
MOVE "value" TO VALUE-2
MOVE "reference" TO VALUE-3
END-MOCK
PERFORM 800-MAKE-CALL
EXPECT VALUE-1 TO BE "content"
EXPECT VALUE-2 TO BE "value"
EXPECT VALUE-3 TO BE "reference"
END-CALL
is ignored by the parser, and is thus allowed in the mock.
TESTCASE "END-CALL is allowed"
MOCK CALL VALUE-2 USING VALUE-1
END-CALL.
MOVE "Local PROG1" TO VALUE-1
END-MOCK
PERFORM 600-MAKE-CALL
EXPECT VALUE-1 TO BE "Local PROG1"