How to run Java tests

You run tests from the command line using the ggcadmin tool which starts a testing session for an application.

Before you begin:
  • It is assumed that your Java test files are compiled in the directory path/to/myTests. The myTests directory is also the package name. To ensure that classes in the package are easy to locate, the path to myTests parent directory must be present in the CLASSPATH variable.
    When executing the scenario, the package-name.provider-class is referenced using the ggcadmin tcp/ua command --scenario-provider option. For example:
    ggcadmin tcp -w path/to/myapp -c "fglrun myapp" --scenario-provider myTests.myScenario
  • If you are using the GAS:
About this task:

In this task you use the ggcadmin tcp command to run tests in direct mode, or ggcadmin ua command to run tests against an application running on the GAS.

Steps

  1. Set your CLASSPATH to point to your path/to/myTests directory.
    For example, run one of the following commands:
    • On Linux®/UNIX™/macOS™:
      export CLASSPATH=$CLASSPATH:/path/to
    • On Windows®:
      set CLASSPATH=%CLASSPATH%;/path/to
  2. To run the tests through the GAS, perform the following:
    1. Run the application you wish to test.
      In your browser launch the application:
      http://localhost:6394/ua/r/myapp
    2. Execute the scenario against the application.
      ggcadmin ua --url http://localhost:6394/ua/r/myapp --scenario-provider myTests.myScenario

Or alternatively you can run the test in direct connection mode

  1. To execute the scenario against the application, perform the following.
    1. Use one of the following commands to execute the scenario against the application.
      • UNIX like OS:
        ggcadmin tcp -w path/to/myapp -c "fglrun myapp" --scenario-provider myTests.myScenario
      • Windows:
        ggcadmin tcp -w "path/to/myapp" -c "fglrun myapp" --scenario-provider myTests.myScenario

        Where -w is the option setting the path to the directory of the test application.

    At the end of the scenario execution for both direct mode and GAS, statistics recorded during the session are displayed as shown in the sample output.
    Note:

    The output is intended as a sample to show test session statistics, the format may change in future product releases.

    Window title is: Product and prices
    Exiting with action 'cancel'
    ...
    == Session statistics == Id: 981aeaaf9f8c4e33a0f67ef576f76393
                    Duration: 0:00:01.370
              Bytes received:      10490
                  Bytes sent:        146
              Scenario count:          1
             Scenario failed:          0
               Checks failed:          0
Forward to GDC
The GGC does not render a graphical user interface. If you use forward-gui option, the GGC still connects to the DVM, but also forwards the Abstract User Interface (AUI) tree to the running Genero Desktop Client (GDC) so that you can see your scenario being executed. For example, to run the test through the GAS to view it running on the GDC on the localhost, run the following command:
ggcadmin ua --url http://localhost:6394/ua/r/myapp --scenario-provider myTests.myScenario -f localhost:0