There are three different unit testing project types in which you can create test fixtures - two projects for native COBOL (one local and one remote), and one for JVM COBOL.
Within these projects, you create test fixtures (type COBOL Unit Test), and within the fixture files, you create the test cases.
Within each test case, you can directly add the code that is under test, thus creating a standalone unit test project. However, the real power of the Micro Focus Unit Testing Framework is when your unit test project calls into another project within the workspace, and tests the code directly at source.
In order to call directly into another project, you must ensure that your unit testing project specifies the project under test in its build path (
or ); then, using procedure pointers and CALL statements, the test cases can access the source code directly. There are other pre-requisites for linking the two projects, which are discussed in Organizing your Workspace.When creating test fixture files for native COBOL, you can use the Create unit test from program option, which will add the necessary configuration required to immediately start coding test cases that call directly into the source code.
Test cases have a number of elements to them, which include a setup phase (to ensure that the test environment is correct), the test itself (which calls into the source code, and makes assertions based on success or failure), and a teardown phase (to tidy up after the test run to ensure no negative effects for subsequent tests).
There is also a fourth section that enables you to code any metadata associated with the test cases. Most metadata is optional, but some tests (data-driven tests) require that you use metadata to set the source of your data. See Using Dynamic Metadata for more information.