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) and 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 SessionProvider 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) that uses a direct connection to the Dynamic Virtual Machine (DVM)
  • a UA configuration (UAConfig class) that runs through the Genero Application Server (GAS) to the DVM
For example, if you are developing your scenarios using 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

Image shows Genero Ghost Client v2 including the BDL scenario server, with the ScenarioProvider managing the session and running several 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 this case it is a UA configuration as the application is tested running on the GAS.
SessionManager
The SessionManager interface manages the runtime and the test Scenario. In this example. there is more than one scenario, so the SessionProvider is created and populated with the scenarios.
GGC scenario program
The scenario you generated 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. There are instructions to select the scenario such as:
 CALL ggc.selectScenario(0)
These are passed in direct binding to the Java API to implement the interface.

Java tests with Ghost Client

The GGC supports testing scenarios written in Java using either:
  • a TCP configuration (TCPConfig class) that uses a direct connection to the Dynamic Virtual Machine (DVM)
  • a UA configuration (UAConfig class) that runs through the Genero Application Server (GAS) to the DVM
For example, if you are developing your scenarios using Java you can specify a direct connection to the DVM (TCP) with the command line tool ggcadmin tcp to run the test in this mode:
ggcadmin tcp -w path/to/myapp -c "fglrun myapp" --scenario 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

Image shows Genero Ghost Client v2 with the ScenarioProvider managing the session and running several 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 this case 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 this example. there is more than one scenario, so the SessionProvider is created and populated with the scenarios.