ggcgen

You use the ggcgen BDL tool to generate test scenarios from a recorded session. It accepts logs recorded by the DVM (guilog) or logs recorded using the Genero Desktop Client (GDC) or Genero Browser Client (GBC).

Syntax

ggcgen command [options] [ argument [...]]
  1. command is either bdl to generate a test scenario in BDL, or java to generate a scenario in Java.
  2. options are described in Options.
  3. argument are log files or skeleton names passed as argument from which scenarios are generated. One scenario per log file. With the --skeleton option, an empty scenario is generated without using a log file.

Options

Table 1. ggcgen options without command
Option Description
-V or --version This option displays version information.
-h or --help This option displays options for the tool.
Table 2. ggcgen version, help, and output options
Option Description
-v or --verbose This option generates verbose output for help with debugging. This option is not enabled by default.
--output-directory This option specifies where to place generated files. Default is current working directory.
--comment-prefix argument This option defines the template's comment prefix. The default punctuation is two exclamation marks, !!, and lines with this prefix are filtered. The argument option allows you to specify an alternative prefix.
--dump-command Expand the command line options that are loaded from a default argument file. See Default argument file.
Table 3. ggcgen template directory option
Option Description
--template-directory argument [...] This option specifies template directories to use (in addition to the default template directory.) The argument option can take a list of directories. The lookup will be performed in the order the arguments appear in the command line.
Table 4. ggcgen dump/wait options
Option Description
--no-wait This option specifies that wait instructions (such as BDL Call ggc.wait() or Java client.wait()) are not generated. The 'wait' instruction is expanded using the wait.4gl code template.
--dump-all This option includes all information (AUI log, AUI tree) as comments in the scenario. Default value is false.
--dump-auitree This option includes the state of the AUI tree as comments between each instruction sent to the DVM. Default value is false.
--dump-auilog This option includes the log file used to generate the scenario as comments in the instructions between the AUI tree and the client. Default value is false.
Table 5. ggcgen check options
Option Description
--check-all This option provides you with optional checks that can be generated and then performed at runtime. It enables all checks provided by the templates in GGCDIR/template/bdl/check_*.4gl.
--check-window This option checks the current window name and title using the template GGCDIR/template/bdl/check_window.4gl
--check-form This option checks the current form name and title using the template GGCDIR/template/bdl/check_form.4gl.
--check-focus This option checks the focused field using the template GGCDIR/template/bdl/check_focus.4gl.
--check-value This option checks the value of the focused field using the template GGCDIR/template/bdl/check_value.4gl.
--check-actions This option checks the active/inactive state of an action using the template GGCDIR/template/bdl/check_action.4gl.
--check-messages This option generates code to check that MESSAGE and ERROR instructions contain expected messages values. It also checks in case values are missing. The GGCDIR/template path has the following templates that enable these checks based on whether your test uses Genero BDL or Java:
  • check_message
  • check_no_message
  • check_error
  • check_no_error
--check-on-snapshot argument [,...] This option generates checks on a snapshot. It takes as an argument of either "all" or a comma-separated list of checks to generate:
  • window
  • form
  • focus
  • value
  • actions
  • messages

In addition to adding the code for the requested checks, each snapshot results in an XML file of the Genero AUI tree as it existed at the time the snapshot was taken. The first snapshot file is named guisnapshot-0.xml; the file name increments (guisnapshot-id.xml) with each additional snapshot recorded in the log. You can edit your scenario and load the values from the guisnapshot-id.xml file using classes of the xml library, to compare those values against the state of the application you are testing.

For more information, see Working with snapshots.

Table 6. ggcgen skeleton option
Option Description
--skeleton This option allows you to generate an empty scenario. The header.4gl and footer.4gl templates only will be generated in the named scenario. Dump and check options will be ignored.
--package-name This option is used with the ggcgen java --skeleton command. It allows you to specify the Java package name.

Usage

You use the ggcgen tool to generate scenarios from a recorded session.

There are several options you can use to effect the generated scenario. You can set the template directory to one with your specific checks. Or if you want to perform standard checks, you can set these with the check options.

For example, for BDL:
ggcgen bdl --template-directory ${GGCDIR}/template/bdl/alternate-checks --check-all mylog.log
Or for Java:
ggcgen java --template-directory ${GGCDIR}/template/bdl/alternate-checks --check-all mylog.log
There are options to debug (--dump-*) when you need to see detailed information such as the state of the AUI tree generated in the scenario.
Note:

In the normal course of testing it is not expected that you will need to use the dump options, except perhaps if the scenario does not behave as expected. Then generating more verbose details may help you to understand where and why it fails.

You can use the --skeleton option to generate an empty scenario. The code from the header and footer templates only will be expanded. It does not require a log file, just the name of the scenario to generate. Multiple scenarios can be created by listing them separated by spaces.

For example, for BDL:
ggcgen bdl --skeleton tests
Or for Java:
ggcgen java --skeleton --package-name tests myscenario