Tutorial: Run ggc demos

You can create a war file that allows you to run Genero Ghost Client (GGC) tests on applications running on your J2EE server.

The goal of this tutorial is to create a test using GGC for applications running on your Java Enterprise Edition (J2EE) server. For more information on GGC, refer to the Genero Ghost Client User Guide

Before you begin:

The demos.war file must be created as described in Tutorial: Run fgl demos.

Steps

  1. Set the GGC and FGLGWS environment:
    1. Start the command line interface and set the environment for your Genero BDL using envcomp.
      • On Linux®/macOS™, change to your Genero BDL installation directory and run the script, for example:
        cd /opt/fourjs/fgl
        ./envcomp 
      • On Windows®, change to your Genero BDL installation directory and run the bat file, for example:
        cd "c:\program files\fourjs\fgl"
        envcomp.bat 
    2. Set the environment for your GGC using envggc.
      • On Linux/macOS, change to your Genero GGC installation directory and run the script, for example:
        cd /opt/fourjs/ggc
        ./envggc 
      • On Windows, change to your GGC installation directory and run the bat file, for example:
        cd "c:\program files\fourjs\ggc"
        envggc.bat 
  2. With a text editor, create a test application source file called edit_test.4gl
    In it, copy the code shown in the example and save:
    
    IMPORT FGL ggc
    
    MAIN
        CALL ggc.setApplicationName("")
        CALL ggc.parseOptions()
    
        # Register scenario functions
        CALL ggc.registerScenario(FUNCTION play_0)
    
        # Start execution
        CALL ggc.play()
    
        EXIT PROGRAM 0
    END MAIN
    
    # Scenario edit_test id : 0
    PRIVATE FUNCTION play_0()
        DEFINE windowTitle STRING
        # Get window title
        LET windowTitle = ggc.getWindowTitle()
        DISPLAY "Window title is: " || windowTitle
        DISPLAY "Exiting with action 'Exit'"
        CALL ggc.wait(100)
        CALL ggc.action("Exit")
        CALL ggc.end()
    END FUNCTION
  3. Compile your test.
    At the command line of the directory where you have stored edit_test.4gl, type the following:
    fglcomp edit_test.4gl
    The application file, edit_test.42m, is created.
  4. Start the GGC server.
    Before you execute a test scenario, you must start the GGC server. To continue in the same terminal window, you must run the command in the background; alternatively, you can open another terminal to start the GGC server from.
    • UNIX® like OS:
      ggcadmin startbdlserver &
    • Windows: Use "start /min" to have the command run in a new, minimized window:
      start /min ggcadmin startbdlserver
  5. Run the demos application on your J2EE server.
    1. If not aleady deployed, deploy the demos.war file (created in Tutorial: Run fgl demos) using your J2EE server tool or deployment portal interface.
    2. Run the demos applications from the J2EE server.
  6. Run the edit_test application to test against the simple-demo application running on your J2EE server.
    For example, type a command like this at the command line of the directory where you have stored the edit_test.42m file.
    
     fglrun edit_test ua --url http://host:port/demos/simple-demo
    You should see output from the test as shown.
    Figure: Running GGC test demos through JGAS

    Image shows the output from a Genero Ghost Client test run through the JGAS
  7. With the test scenario complete, stop the GGC server.
    ggcadmin stopbdlserver
    For more information on Genero Ghost Client, see the Genero Ghost Client User Guide.