The copybook used for the working storage appears in the editor.
01 errormessage pic x(200).
entry "MFUT_TESTAIRCODE". allocate lnk-airport1 allocate lnk-airport2 allocate lnk-distance-result move "LHR" to lnk-airport1 *> London Heathrow move "SEA" to lnk-airport2 *> Seattle perform distance-between-airports. *> Assertions to check that the correct distance is returned if function numval(distance-miles) not equal 4787 string "Incorrect distance in miles returned - " distance-miles delimited by size x"0" delimited by size into errormessage end-string call MFU-ASSERT-FAIL-Z using errormessage end-if if function numval(distance-km) not equal 4787 string "Incorrect distance in kilometers returned - " distance-km delimited by size x"0" delimited by size into errormessage end-string call MFU-ASSERT-FAIL-Z using errormessage end-if goback .
This code makes a call to the code under test, which performs the distance-between-airports section with the given airport codes for Heathrow and Seattle. It then makes assertions based on the results of the perform operation.
entry MFU-TC-SETUP-PREFIX & "TESTAIRCODE" perform open-airfile. goback .
This entry point will be run first during the test run, and will attempt to open the data file used for the test case.
entry MFU-TC-TEARDOWN-PREFIX & "TESTAIRCODE" perform close-airfile. goback .
This entry point will be run last during the test run, and will close the data file after the test case has run.
This opens the Run Configurations dialog box.
This opens the Add Variable dialog box.
Test cases within this unit test project will now use the original data file used by the AirportDemo application.
The test case reruns, but should fail with the following output:
The next step is to debug the test, to find out why it failed.