The New COBOL Unit Test dialog box appears.
The test fixture file is created within the unit test project, and includes the skeleton code required for one test case.
input-output section. file-control. select cust assign to 'cust.txt' organization is line sequential.
And add the following immediately after the line data division:
file section. fd cust. 01 cust-file. 03 customer-id pic 9(5). 03 customer-info pic x(65).
open output cust
This sets up the test by opening the file, ready for any file operations performed in the test case itself.
The MFU-TC-METADATA-SETUP-PREFIX & TEST-program-name entry point contains some details about the test case.
move "This is a simple test to write to a data file" to MFU-MD-TESTCASE-DESCRIPTION
move 0 to customer-id perform 100 times add 1 to customer-id move "A customer" to customer-info write cust-file end-perform.
The test case performs a simple write operation on the file. if this fails, the test case is marked as failed. This is also the section in which you would add your own test assertions; see Determining a test outcome for more information.
The teardown section tidies up the environment.
The test case is now complete, ready to be run; refer to Running Unit Tests.