Handling frontcalls in a generated test

As a developer, you must handle how frontcalls are handled in your unit test.

There are several frontcall implementations that are handled by default by the GGC:
  • Frontcall ui.Interface.frontCall("standard","feInfo",["feName"],[info]) returning "GGC"
  • Frontcall ui.Interface.frontCall("standard","feInfo",["osType"],[info]) returning "Windows" or "Unix"
For all others, you must decide how the test will handle the frontcall. You may:
  • Ignore any frontcall and manage the behavior in the source application by nesting your frontcalls in an IF statement:
    CALL ui.Interface.frontCall("standard", "feInfo", ["feName"], [info])
    IF info != "GGC" THEN
      CALL ui.Interface.frontCall("standard","feinfo","userPreferredLang",result)
      ...
    END IF
  • Decide to mimic the recorded log exactly. You register the frontcall values using the com.fourjs.ggc.fgl.Application.registerFrontcallResult() API. Refer to the GGC javadoc for more information.
  • Decide to use generic values. You register the generic values using the com.fourjs.ggc.fgl.Application.registerFrontcallResult() API. Refer to the GGC javadoc for more information.

Depending on the call, the correct option for each frontcall in your test may differ.

Finding frontcalls in the generated test

If your application includes a frontcall, the frontcall is highlighted in the generated test within comments.

For example, if your application contains this frontcall:
CALL ui.Interface.frontCall("standard","feinfo","userPreferredLang",result)
DISPLAY result
The generated unit test will include comments:
-- Frontend Call:
-- FunctionCall 100 (moduleName = "standard", name = "feinfo", isSystem = "0", 
   paramCount = "1", returnCount = "1") {
--   FunctionCallParameter 101 (dataType = "STRING", value = "userPreferredLang",
     isNull = "0") { } }
-- Frontend result:
-- <FunctionCallEvent id="0" result="0" ><FunctionCallReturn id="0" 
   dataType="STRING" isNull="0" value="en_US" ></FunctionCallReturn></FunctionCallEvent>
It is important to understand that no actual 4GL code is created in the generated test. It is up to you to decide what you want to return for the frontcall and modify the generated test accordingly.