Example - Running MFUnit Tests

The following example demonstrates how you can configure Jenkins to run MFUnit tests against a COBOL application.

Enterprise Developer for Visual Studio must be installed on the machine where you will run the MFUnit tests. You are going to use one of the samples stored in the \COBOL\AirportMFUnitDemo subfolder in the location of the Enterprise Developer samples (%PUBLIC%\Documents\Micro Focus\Enterprise Developer\Samples).

  1. Create a Jenkins project.
  2. Configure the project to work with COBOL - see Setting up the Environment.
  3. In the Build section of the project's configuration page, enter the following commands to copy the samples files to a test folder on the machine:
    if exist c:\test rd /s/q c:\test
    mkdir c:\test
    copy "C:\Users\Public\Documents\Micro Focus\Enterprise Developer\Samples\mfunit\*" c:\test
    cd /D c:\test
    call examples.bat
  4. Build your project.

    After the project build completes, there is a blue icon next to the project on the Jenkins Home page which indicates that the build was successful. This, however, is not correct.

  5. Check the project's console output.

    In the text output you'll see that some tests failed even though the blue indicator in the previous step suggests that everything ran successfully:

    Micro Focus COBOL - mfurun Utility
    Unit Testing Framework for Windows/Native/32
    Options : verbose=true,process=separate,junit=true,printfile=true
    Fixture filename : MFUTASCI.dll
     Preparing test case : MFUTASCI
     Executing test case : MFUTASCI
     Completed test case : MFUTASCI - Failed
     Generating junit xml : TEST-MFUTASCI.xml
     Generating report : MFUTASCI-report.txt
    Test Run Summary
     Overall Result            : Failed
     Tests run                 : 1
     Tests passed              : 0
     Tests failed              : 1
     Total execution time      : 3

    Although the tests ran to completion, there were a number of test failures that should have caused this build to fail.

    You now need to enable test reporting.

  6. In the project's configuration page, navigate to the Post-Build actions section.
  7. Click Add post-build action > Publish Junit test result report.
  8. In Test report XMLs, enter *.xml and then save the configuration.
  9. Build the project again.

    Note that this time the status ball has turned yellow. This indicates that the build ran to completion but there were some test failures.