Micro Focus Unit Testing Framework Support

The Micro Focus COBOL extension supports TEST EXPLORER integration for the unit testing framework, MFUnit, provided by the Micro Focus Enterprise Developer products.


  • A licensed installation of a Micro Focus Enterprise Developer product, release 9.0 or later.
  • Specify the location of the licensed product in the extension setting Micro Focus COBOL: Install Location.

The TEST EXPLORER shows unit tests within your workspace, and enables you to run and debug them in Visual Studio Code.

Alternatively, you can compile your Visual Studio or Eclipse COBOL test projects from the command line. See The Micro Focus Unit Testing Framework in your Enterprise Developer product documentation for details.

Configure test discoverers

A discoverer defines where unit tests are located within a workspace and which runner and COBOL environment should be used to load them. In the settings.json file, use the setting microFocusCOBOL.mfunit.discoverers to configure your test discoverers. To set one or more discoverers:

  1. In Visual Studio Code, click File > Preferences > Settings.
  2. Expand Extensions, and click Micro Focus COBOL.
  3. Go to the setting Micro Focus COBOL > Mfunit: Discoverers, and click Edit in settings.json.

    This opens the settings.json file with the discoverers option ready for input.

As an example, two discoverer configurations can look like:

	"microFocusCOBOL.mfunit.discoverers":	[
			"globPattern": "bin/*.{dll, so}",
			"is64Bit": false,
			"runner": "mfurun",
			"globPattern": "bin.net/*.dll",
			"is64Bit": false,
			"runner": "mfurunil",

Where the following runner options are available in Windows:

Option Executable Notes
mfurun mfurun.exe Use with native COBOL.
mfurunil mfurunil.exe Use with .NET COBOL.
mfurunil6 mfurunil6.exe 64-bit only if using a Micro Focus product 9.0 release or later. Use with .NET COBOL.
mfurunj mfurunj.bat Use with JVM COBOL.

The following runners are used for UNIX platforms.

Option Notes
cobmfurun_t Use with threaded RTS.
cobmfurun Use with non-threaded RTS.
cobmfurunil6 64-bit only if using a Micro Focus product 9.0 release or later. Use with .NET COBOL.
cobmfurunj Use with JVM COBOL.

Once a discoverer has been set, you can build the COBOL sources and any tests found in the globPattern will be populated in the TEST EXPLORER. If the unit tests do not populate the TEST EXPLORER:

  1. Go to the Output pane, click the output channel drop-down list and select Micro Focus Unit Test Discovery.
  2. View the information concerning unit tests to diagnose the problem.

View and run tests

  1. Compile your source files as instructed in the Compiling section of the documentation.
  2. After compiling, click Testing to open the TEST EXPLORER. This displays all unit tests in your workspace.
  3. You can run all unit tests in your workspace by clicking Run Tests in the toolbar of the TEST EXPLORER. You can also run individual tests by clicking Run Test next to a test file.

    A test can pass, fail, or encounter an error. The result is indicated by the symbol next to the test file.

  4. Click (Show Output) in the toolbar to view the Test Output tab in the Terminal.

  5. Click the Test Results panel to view the output of any tests.

Debug tests

  1. Set one or more breakpoint(s) in the unit test you want to debug.
  2. Click Debug Tests in the toolbar of TEST EXPLORER to debug all unit tests.
  3. Click Debug Test to debug an individual test file.
  4. Step through the code as normal using the Debug Console.