Set test environment

There are options available to specify the environment for a test run in direct connection mode (tcp) to the Genero Desktop Client.

About this task:

The GGC has options to set environment for tests handled by ggcadmin and BDL scenario program tcp commands.

By setting the environment option (-e or --environment-file), it allows you to get an environment variable, such as the database path (FGLDBPATH), of the tested program for the test execution.

In this task, you provide a list of environment variables in a text file.

Steps

  1. Navigate to your test directory.
    This example uses a directory named /test_dir.
  2. Create a text file in your test directory, myenv in the example.
  3. Add entries for each environment variable you need to specify.
    For example:
    FGLGUIDEBUG=1
    FGLIMAGEPATH=${MYAPPROOT}$(file.separator)images$(path.separator)${FGLDIR}/lib/image2font.txt"

    For OS independence:

    • Environment variables that need to be expanded are referenced using a dollar sign and curly braces (same for both UNIX® and Windows®).
    • The $(path.separator) predefined resource resolves a separator in list of paths to colon (:) on UNIX platforms and semi-colon (;) on Windows.
    • The $(file.separator) predefined resource resolves a separator in a file path to slash (/) on UNIX platforms and back slash (\) on Windows.
  4. Type one of the following commands to run the test depending on whether your tests are written in BDL or Java.
    • BDL:
      fglrun myapp_test.42m tcp --environment-file myenv -c "fglrun myapp"
    • Java:
      ggcadmin tcp -w path/to/myapp --environment-file myenv -c "fglrun myapp" --scenario test_dir.myapp_test

The test runs and the results display in the output.