A portable environment file is a text-based configuration file that is utilized by the Micro Focus Unit Testing Framework to provide environment variables specified in a test case.
You can use the same portable environment file for a test case compiled in a number of different ways, and run on a number of different platforms. By settings different values for a variable within the sections detailed in the table below, the Micro Focus Unit Testing Framework will determine the appropriate value for the test. As well as the global section, one section from each of the platform, compilation, bitism, and threading sections is active for any one test run.
When coding a protable environment file, you may omit sections that you do not require, and included sections can be coded in any order. Where multiple sections are in effect that contain the same variable, the value is taken from the last section specified.
To ensure that the file is used when you run the tests, save it with the same base name as the base name of your test suite (i.e. the base name of your .int, .gnt, .so, or .mfu file), and with an extension of .mfuenv, and then place it in the same location as your test suite.
Section name | Purpose |
---|---|
[global] | Section used for all tests irrespective of platform, bitism, etc... |
[windows] | Section used depending on operating system flag. |
[unix] | |
[jvmgen] | Section used when the test is compiled to JVM COBOL. |
[dotnet] | Section used when the test is compiled to .NET COBOL. |
[dotnet_core] | Section used when the test is compiled to .NET COBOL and you are using .NET Core. |
[native] | Section used when the test is compiled to any of: int, gnt, obj, dll, exe, or so. |
[64bit] | Section used depending on the bitism used during compilation. |
[32bit] | |
[threaded] | Section used when the threaded Run-Time System is in effect. |
[non-threaded] | Section used when the non-threaded Run-Time System is in effect. |
[windows] CSV_BASEDIR=C:\tests\ [unix] CSV_BASEDIR=/home/tests/ [global] CSV_DATADIR=${CSV_BASEDIR}data
... ENTRY "MFUM_DOBQUOTE". move "csv:$CSVDIR/dobquote.csv" to MFU-MD-TESTDATA goback. ...
The following portable environment file resolves the CSVDIR variable to data_win_64 when compiled to 64-bit on Windows; data_win when compiled to 32-bit on Windows; data_64 when compiled to 64-bit on Linux; and data when compiled to 32-bit on Linux. (The building of the path is cumulative as it works through the file.)
[global] filepath=data [windows] filepath=${filepath}_win [64bit] filepath=${filepath}_64