How to automatic create Unit Test case for all of procedures in Cobol program

I using Visual Cobol IDE to generate Cobol Unit Test case for each cobol program in my project, base on guide : https://www.microfocus.com/documentation/visual-cobol/VC40/EclUNIX/GUID-D5F12D24-BB4D-4CC4-920B-0A4DE99E1F29.html

But, I see that it only generate one case for each program

Ex : with 'XXX.cbl' file which has 2 procedures are PROCEDURE1, PROCEDURE2,..., it only generate in XXXTest.cbl (test case file) such as :

call "XXX" using by reference LINK-AREA-IO-01,

Instead of, 

call "PROCEDURE1" using by reference LINK-AREA-IO-01,

.....

call "PROCEDURE2" using by reference LINK-AREA-IO-02,

 

Visual Cobol IDE can support to generate same that or I have to self write by hand ?

 

  • Unit tests for multiple entry points within a program can be generated by the Unit Test Wizard. There is an Add New button on the botton that allows you to select additional entry points from a drop-down list.

    ut.JPG

  • Dear Mr.Chris Glazier,

    Thank you for answering me but in MF Visual Cobol IDE (trial 30 days) in my PC, there is not dialog which same as you showed. In my PC, only show dialog as below

    Untitled.png

  • Which version of Visual COBOL are you using? It appears like it might be 3.0 which is not the latest release.

    The support for multiple entry point selection for a COBOL Unit Test was added to the 4.0 product release.

    If I right-click in a program containing multiple entry points and select Create Unit Test I will get the Dialog that I showed previously.

  • Dear Mr.Chris Glazier,

    I using Micro Focus Visual COBOL 4.0 for Eclipse (Windows)

    Version: 4.0.243.v201805162240

    But can not show dialog create Unit Test as you said.Untitled1.png

  • I am sorry that I didnt realize you were using the Eclipse IDE. I was testing with Visual Studio and that already has the support for multiple entry points for Unit Tests.

    The Eclipse IDE will have that capability in the next major product release which will be V5.0 due to be available sometime in June. You will then be able to accompish what you wish.

    Thanks

  •  , I'm using VC 4.0 Eclipse for Windows and, if the program that I want to test has multiple entry points, I can create a unit test specific to each (see attached).  Can you please describe what VC 5.0 might add for Eclipse?

  • I am sorry, you are correct. This feature is part of V4.0. I accidently selected a test that only had one entry point when I tried it.

    The original problem reported is because the option "create unit test from template" appears to be selected which will only create a generic unit test code and then has to manually be entered in.

    You must select the option "create unit test for program" must be selected and then after selecting the desired program all of the entry points will appear in the list.

     

  • Dear Mr. StompinBob,

    "AIRCODE" and "TEST" in your image are procedures in a Cobol file ?
    In my IDE, it show only one entry point (is D5211311) which is PROGRAM-ID (Cobol file name too), aren't procedures

    Untitled1111.png

    Instead of that, I want it show to select 2 procedure (DATA-CHECK, MG-SET) of above PROGRAM-ID

    Untitled33333.png

    How to make it show same as you ? :(

  • The "Procedure Division Using" statement is the default entry point for a COBOL program.  However,  you can add additional entry points to your program with the "Entry" statement.  For my example, I just added a second entry point called "Test" to the one of the sample programs that ship with the product.  Sadly, unless you're using OO COBOL, I think you're stuck with creating unit tests that map to entry points, with the "Procedure Division Using" being the likely entry point you will use. 

  • Dear StompinBob,

    Yes, That's right. I'm stuck with creating unit tests that map to entry points, with the "Procedure Division" being the likely entry point which I will use.
    Base on your answer, I understand that VS Cobol IDE has not support automatic create test case for each entry point which are prodecure in "Procedure Division", incase cobol version is not OO Cobol (such as Visual Cobol II, IBM Cobol, Net Cobol, ...), Is that right ?

    If right, why is that ? Is there no way ?

    I really want to unit test each procedure in "Procedure Division"   to compare the input/output values of them with the input/output values of each corresponding method in JAVA source after converted ! :(