Implement front calls in a test

Implementing a custom front call in your test.

In this task you implement a custom front call that overloads the default front call implementation to return the name of the front-end.

  1. Write a function that takes a front call request as a parameter and returns the front call answer.
    This function has the following format:
    FUNCTION myCustomFrontCall (request ggc.FrontCallRequest INOUT) RETURNS ggc.FrontCallAnswer

    See the sample function implementation of standard.feInfo("feName") in Example: custom front call (BDL).

  2. Register this function for callback before the function play is called.
    For example, in the MAIN block of your scenario:
    MAIN
        # Register custom front call handler
        CALL ggc.registerFrontCallHandler(FUNCTION myCustomFrontCall)
        # ...
        CALL play()
        EXIT PROGRAM 0
    END MAIN
  3. In your test application, make sure you have a front call action that you can test.

    For example, a menu action:

    MAIN
        DEFINE answer STRING
        OPEN FORM f FROM "frontcall"
    
        DISPLAY FORM f
        MENU "FrontCall"
          ON ACTION fename
            CALL ui.Interface.frontcall("standard","feinfo", ["fename"],[answer])
            MESSAGE answer
            ON ACTION quit
            EXIT MENU
        END MENU
    END MAIN
  4. In the play function of your scenario test the action ( fename in the example ).
    For example:
    FUNCTION play()   
        DEFINE msg ggc.Message
        CALL ggc.action("fename")
        CALL ggc.getMessage() RETURNING msg.*
        DISPLAY msg.message
        ...
    END FUNCTION