The Genero Ghost Client framework

The Genero Ghost Client is a Java framework for building application tests.

GGC infrastructure overview

The GGC architecture is designed to test scenarios written in Genero Business Development Language (BDL) or Java. The underlying APIs define functionality that is independent of the implementation. It is made up of interfaces, classes, and tools that handle all of the low-level code of generating tests so that you can quickly build scenarios to test your applications.

Some of the main interfaces of the GGC are described in Table 1.
Table 1. Ghost Client main interfaces
Interface Description

SessionManager

Instantiates and manages Scenario instances according to incoming VM connections and new runtime launches.
Scenario A Scenario is by default a function call handler. It invokes front calls and its Play method handles the interface with the client by providing the Client instance as a parameter.
ScenarioProvider If there is more than one scenario, the ScenarioProvider is created and populated with the scenarios.
Client The Client interface provides all the methods to interact with the DVM or get information on the current state or content of the application.

It includes methods for delays between actions, like wait(1000), generating events like action("quit"), key("Tab"), or collapseTree("myTreeView", 10 / row number /), and so on. It also provides some introspection utilities like getValue() that returns the value of the focused field.

For details of the Java packages and classes, see the javadoc distributed with the Genero Ghost Client in your FGLGWS installation. The javadoc is found in your $GGCDIR/doc/javadoc/ directory. See the help file by launching the $GGCDIR/doc/javadoc/index.html file in your browser.

BDL tests with Ghost Client

The GGC supports tests using either:
  • a TCP configuration (TCPConfig class). This configuration uses a direct connection to the Dynamic Virtual Machine (DVM).
  • a UA configuration (UAConfig class). This configuration runs through the Genero Application Server (GAS) to the DVM.
If you are developing your scenarios using Genero BDL, you can specify a UA configuration in the command line to run the test against the application running on the GAS:
fglrun test_sample ua --url http://localhost:6394/ua/r/myapp
For examples of running BDL tests, see How to run BDL tests.
Figure 1 shows the BDL scenario server running three test scenarios through the GAS, with the ScenarioProvider managing the session.
Figure: Ghost Client BDL testing scenario using GAS

The Genero Ghost Client v4 including the BDL scenario server, with the ScenarioProvider managing the session and running three test scenarios through the GAS.
The tests are implemented by the following GGC components:
UAConfig/TCPConfig
The UAConfig/TCPconfig is the configuration created for the session. In our example, it is a UA configuration as the application tested is running on the GAS.
SessionManager
The SessionManager interface manages the runtime and the test Scenario. In our example, there is more than one scenario, so the ScenarioProvider is created and populated with the scenarios.
GGC scenario program
The scenario for the test (test_sample in our example) includes all scenarios from the session. This program sends instructions to the BDL scenario server as each scenario is tested.

Java tests with Ghost Client

The GGC supports testing scenarios written in Java using either:
  • a TCP configuration (TCPConfig class). This configuration uses a direct connection to the Dynamic Virtual Machine (DVM).
  • a UA configuration (UAConfig class). This configuration runs through the Genero Application Server (GAS) to the DVM.
You can run your Java test scenario using a direct connection to the DVM (TCP) with the command line tool ggcadmin tcp:
ggcadmin tcp -w path/to/myapp -c "fglrun myapp" --scenario-provider myTests.test_sample
For examples of running Java tests, see How to run Java tests.
Figure 2 shows the ScenarioProvider managing the session and running three test scenarios in direct connection mode.
Figure: Ghost Client Java testing scenario using direct connection

Genero Ghost Client v4 with the ScenarioProvider managing the session and running three test scenarios in direct connection mode.
The tests are implemented by the following GGC components:
UAConfig/TCPConfig
The UAConfig/TCPconfig is the configuration created for the session. In our example, it is a TCP configuration as the application is tested running in direct mode.
SessionManager
The SessionManager interface manages the runtime and the test Scenario. In our example, there three scenarios. The --scenario-provider option specifies that the scenario provider class (test_sample in the command example) is being used to run the test.