There are different types of unit tests that you can add to a COBOL unit test project or a remote COBOL unit test project:
- Program unit tests
- In its most basic form, a program unit test is a single fixture file that contains the source code to be tested, the test
code itself, and all the supporting code and metadata required to run the program through the
Micro Focus Unit Testing Framework. These standalone tests do not have a dependency on any other project.
- The other type of program unit test has the ability to call into another native COBOL or mainframe project within the workspace.
This allows source code to remain untouched in its native project, and test case code is written and run against the source
from the unit test project.
- This type of unit test can call into multiple entry points within the source program, or can be a data-driven test, where
values read from a data source are passed through the same test code repeatedly. For data-driven test, only one entry point
in the source program can be put under test.
- Self-contained unit tests
-
A self-contained test is a type of unit test that enables you to insert your test code into the program under test when it
is running under the
Micro Focus Unit Testing Framework (native COBOL and mainframe COBOL sources only).
By doing this you can test on a more granular level than you can with a program test. With the source code and testing code
running as a single unit of work, your unit test can run test assertions on any section or paragraph within the source program.
This negates the need for the test setup and teardown code often required for program tests.
- If your source project is built to executable, this is the only type of test that you can use.
Both of these types of unit tests are available for remote projects as well, as long as the source project and the unit test
project share the same remote connection (that is, are on the same remote machine).
For COBOL JVM projects and remote COBOL JVM unit test projects, there is only one type of unit test available:
- COBOL JVM unit tests
- This type of test generates a test fixture similar to that of a standalone program unit test for native COBOL. The test fixture
file contains stub code for each of the standard test elements, and also inserts links to the required
Micro Focus Unit Testing Framework copybooks.