The testing framework

There are five steps in creating and executing a test.

  1. Verify the environment.

    The FGL Utilities environment set contains several environment variables necessary for the creation and execution of tests. Ensure the environment set is selected (checked) for the Genero configuration in use.

    This environment set includes the following GGC-related environment variables:
    GGCDIR
    Specifies the location of the GGC. By default, GGC is included inside FGLDIR. You should not need to change this environment variable.
    GGCTPLDIR
    Genero Studio To use custom GGC templates, set this environment variable to the location of your new template directory. To use the default GGC template directory, leave this blank. For more information on creating and using custom templates, see the Genero Ghost Client User Guide.
  2. Create the test.

    Create the test for your application by selecting Create test and executing the application. Your app runs locally or remotely, depending on the configuration. After navigating the interface and performing the steps to be tested, quit the application. Internally, a GUILOG is created for the app (local or remote). A .4gl test file is then generated from the GUILOG. The .4gl code is based on the interactions with the application while the log was recording. This includes opening windows, setting field values, executing actions, and so on.

  3. Add the test to a project.

    Save the .4gl test file to a project. Create an application node for your test, and add the .4gl test file to the new application node. Right-click on the application test node and select Advanced Properties. Set a dependency with the application being tested.

    Your project can contain only the single test, or you can create a project to serve as a test suite inclusive of multiple tests. If you create a test suite, you must also create an application to call the generated tests.

    Update the Command line arguments property to the application node for the test. At a minimum, this property must specify the argument to identify the working directory, such as "tcp --working-directory ../bin". Refer to the Genero Ghost Client User Guide for a full list of command line options.

  4. Edit the test and add assertion checks.

    Assertion checking is where you verify that the application works as it did previously, repeatedly.

    When the test is generated, every possible step and test is added to the .4gl file. The generated code usually contains far more checks than what you expect; but this is intended as it is easier to remove things than to write new checks and tests by hand. Update the .4gl file to remove parts of the test that are no longer needed or to add new checks and tests.

    You may need to update initialization and finalization tasks to ensure the data is correct for the test.

  5. Run the test.

    Before running the test, ensure that the test application node has a dependency set on the application being tested.

    The app is run as a child process. The test runs the app and plays the role of a GUI client (using GGC) and runs the checks set in the .4gl file.

For specific instructions on completing these tasks, see Create and run a unit test.