Genero BDL API for GGC

The Genero BDL API for GGC provides types, functions, and methods for writing and generating tests in Genero BDL.

Import the API

The module $GGCDIR/lib/ggc.42m defines the API. To implement it in your test, add the instruction IMPORT FGL ggc to your Genero BDL test module.

Table 1. Genero Ghost Client - BDL Types
Types Description
PUBLIC TYPE FrontCallAnswer RECORD
    type STRING,
    status STRING,
    errorMessage STRING,
    returnValues DYNAMIC ARRAY OF RECORD
        isNull BOOLEAN,
        value STRING,
        index INTEGER,
        dataType STRING
    END RECORD
END RECORD
The FrontCallAnswer type defines a record for retrieving the result of a front call.
PUBLIC TYPE FrontCallRequest RECORD
    frontCall RECORD
        moduleName STRING,
        functionName STRING,
        paramCount INTEGER,
        returnCount INTEGER,
        parameters DYNAMIC ARRAY OF RECORD
            dataType STRING,
            isNull BOOLEAN,
            value STRING
        END RECORD
    END RECORD,
    errorMessage STRING
END RECORD
The FrontCallRequest type defines a record for retrieving front call request details.
PUBLIC TYPE Message RECORD
    isErrorMessage INTEGER,     
    message STRING              
END RECORD
The Message type defines a record for retrieving errors and messages.
# Statistics data
PUBLIC TYPE Statistics RECORD
    sessionId STRING,
    bytesSent STRING,
    bytesReceived INTEGER,
    scenarioCount INTEGER,
    scenarioFailed INTEGER, 
    downloadCount INTEGER,
    downloadFailed INTEGER,
    downloadBytes INTEGER,
    sessionDuration RECORD
        startTime BIGINT,
        endTime BIGINT
    END RECORD,
    downloadFailures DYNAMIC ARRAY OF STRING,
    checkFailures DYNAMIC ARRAY OF RECORD
        fileName STRING,
        lnum INTEGER,
        message STRING
    END RECORD,
    failures DYNAMIC ARRAY OF RECORD
        fileName STRING,
        lnum INTEGER,
        message STRING
    END RECORD,
    vmErrors DYNAMIC ARRAY OF STRING
END RECORD
The Statistics type defines a record for retrieving test result statistics.
Table 2. Functions testing actions and keys
Function Description
action(
   name STRING )
Execute an action by name.
key(
  keyName  STRING )
Send a key by name.
idle()
Execute an ON IDLE action.
timer()
Execute an ON TIMER action.
setSpeedRatio(
  speedRatio FLOAT )
  RETURNS FLOAT
Adjust the pace of ggc.wait(delay) commands.
wait(
  mseconds  INTEGER )
Set a delay between test instructions.
Table 3. Functions for interacting with simple form fields
Function Description
setFieldValue(
   fieldName STRING,
   value  STRING )
Set value in a form field.
setFocus(
   fieldName   STRING )
Set focus on a field.
setValue(
   value  STRING )
Set value in the current field.
Table 4. Functions for interacting with tables
Function Description
hideTableColumn(
   tableName  STRING,
   columnName  STRING )
Hide a table column.
setCellFocus(
   tableName  STRING,
   columnName  STRING, 
   row  INTEGER)
Select a cell in a table.
setRowFocus(
   tableName  STRING,
   row  INTEGER)
Select a table row.
setRowSelection(
   tableName STRING,
   selectionMode STRING,
   startIndex INTEGER,
   endIndex INTEGER)
Update a multiple row selection state.
setTableOffset(
   tableName  STRING,
   pageSize   INTEGER )
Set the table page size offset value.
setTableSize(
   tableName  STRING,
   size  INTEGER )
Set the table size.
showTableColumn(
   tableName  STRING,
   columnName    STRING )
Show a hidden table column.
sortTable(
   tableName  STRING,
   columnName  STRING, 
   sortType STRING)
Sort a table.
Table 5. Functions for interacting with tree views
Function Description
collapseTree(
   treeName STRING,
   row INTEGER )
Collapse a node (row) in a tree view.
expandTree(
   treeName STRING,
   row INTEGER )
Expand a node (row) in a tree view.
Table 6. Functions for retrieving information and data
Function Description
getActions()
   RETURNS DYNAMIC ARRAY OF ggc.Action
Returns the list of actions in the tested application.
getButtonText(
    buttonName  STRING)
  RETURNS STRING
Get the text from the specified button.
getDialogComment()
  RETURNS STRING
Get the comment from a dialog.
getFieldValue(
  fieldName STRING)
  RETURNS STRING 
Return the value in a specified form field.
getFieldValues(
  name STRING)
  RETURNS DYNAMIC ARRAY OF STRING 
Return a list of values from a table, tree, or screen record.
getFocus()
  RETURNS STRING
Return the name of the current focused element.
getFormName()
  RETURNS STRING
Get the current form name.
getFormTitle()
  RETURNS STRING
Get the current form title.
getUserData(
  keyName STRING)
  RETURNS STRING 
Return the value of the user data.
getValue()
   RETURNS STRING 
Return the value in the current field.
getValues()
   RETURNS DYNAMIC ARRAY OF STRING
Returns the values of the current row of the current table, tree, or matrix.
getWidgetType(
  fieldName STRING)
  RETURNS STRING
Return the widget type of the specified field.
getWindowName()
  RETURNS STRING
Get the current window name.
getWindowTitle() RETURNS STRING
Get the current window title.
Table 7. Functions for retrieving messages and errors
Function Description
getError()
  RETURNS ggc.Message
Return the current error message.
getMessage()
  RETURNS ggc.Message
Return the current message.
throwExceptions(
   te BOOLEAN )
Configure GGC to stop if action fails.
Table 8. Functions for retrieving action state
Function Description
isActionActive(
  name STRING )
  RETURNS BOOLEAN
Return the state of the specified action.
Table 9. Functions for retrieving information about tables
Function Description
getColumnCount(
   tableName  STRING )
  RETURNS INTEGER 
Get the number of columns in a table.
getColumnName(
   tableName  STRING, 
   idx INTEGER  )
  RETURNS STRING
Get a table column name.
getColumnValue(
   tableName  STRING,
   columnName STRING,
   row  INTEGER )
  RETURNS STRING
Get the column value of a table, tree, or screen record at the specified row.
getColumnValues(
   tableName  STRING,
   columnName STRING )
  RETURNS DYNAMIC ARRAY OF STRING
Get column values of a table, tree, or screen record.
getCurrentColumn(
   tableName  STRING )
  RETURNS INTEGER 
Get the current column in a table.
getCurrentRow(
   tableName  STRING )
  RETURNS INTEGER
Get the current row of the table.
getTableOffset(
  tableName  STRING)
  RETURNS INTEGER
Get the table's current offset value.
getTableSize(
  tableName  STRING)
  RETURNS INTEGER
Get the table size.
getTablePageSize(
   name  ) RETURNS INTEGER
Get the number of visible rows of the table or tree.
Table 10. Functions for working with scenarios
Function Description
setApplicationName(
    name  STRING )
Set the application name.
registerScenario(
    FUNCTION function_name )
Registers a scenario function for testing.
getScenarioId()
  RETURNS STRING
Returns the Id of the Scenario.
play()
Plays a scenario for testing.
end()
Ends a scenario for testing.
stop()
Stops the GGC.
stopBDLServer()
Stops the BDL server if it was started by the scenario.
cleanup()
Finalizes the scenario execution and performs additional cleanup.
Table 11. Functions for retrieving session information
Function Description
getApplicationName() 
  RETURNS STRING
Retrieve the application name.
getChildCount()
  RETURNS INTEGER
Retrieve the number of running child applications.
getSessionId()
  RETURNS STRING
Get the current session identifier.
getState()
  RETURNS STRING
Retrieve the application state.
getStatistics()
  RETURNS Statistics
Retrieve the test session statistics.
notifyCheckFailure( message STRING ) 
Report a check failure.
notifyCheckFailureEx(  
        fileName STRING,
        lineNo INTEGER,
        message STRING ) 
Report a check failure, and provide the error information: file name, line number, and error message.
notifyFailure( message STRING ) 
Report a scenario failure.
notifyFailureEx(
        fileName STRING,
        lineNo INTEGER,
        message STRING 
Report a scenario failure, and provide the error information: file name, line number, and error message.
showStatistics()
  RETURNS Statistics
Show test statistics.
parseOptions()
Fill a dynamic array with program arguments.
Table 12. Functions for working with front calls
Function Description
registerFrontCallHandler(FUNCTION function_name )
Registers a front call function for testing.
Table 13. Methods for the FrontCallRequest
Method Description
(r FrontCallRequest) getFunctionName()
  RETURNS STRING
Returns the front call name.
(r FrontCallRequest) getModuleName()
  RETURNS STRING
Returns the front call module name.
(r FrontCallRequest) getParameterCount()
  RETURNS INTEGER
Returns the parameter count to the front call.
(r FrontCallRequest) getParameterValue(
  index INTEGER)
  RETURNS STRING
Returns the parameter values to the front call.
(r FrontCallRequest) getReturnCount()
  RETURNS INTEGER
Returns the return values count to the front call.
Table 14. Methods for the FrontCallAnswer
Method Description
(a FrontCallAnswer) functionNotFound()
Initializes a front call answer object with "Function not found" error.
(a FrontCallAnswer) moduleNotFound()
Initializes a front call answer object with "Module not found" error.
(a FrontCallAnswer) notProcessed()
Leave the front call unprocessed.
(a FrontCallAnswer) returnInteger(
  value INTEGER )
Adds an integer return value.
(a FrontCallAnswer) returnString(
  value STRING )
Adds a string return value.
(a FrontCallAnswer) stackError()
Initializes a front call answer object with "Stack error" error.
(a FrontCallAnswer) success()
Initializes a front call answer object with SUCCESS status.
(a FrontCallAnswer) userError(errorMessage STRING)
Initializes a front call answer object with custom error and error message.