Quick Start: Generate and execute a test scenario

With this quick start, you will prepare your environment, compile a simple application, record a guilog, generate a test scenario from the guilog file, and execute the test scenario.

In working with this quick start, you will get an understanding of Genero Ghost client basics and you see how you can use it for testing scenarios using your Genero BDL applications.

This quick start lets you experiment with two procedures:
  • running a test scenario that uses a direct connection to the Dynamic Virtual Machine (DVM)
  • running a test scenario that uses an application running on the Genero Application Server (GAS)
Before you begin:

Run a test scenario using a direct connection

Steps

  1. In your command line window, navigate to the directory where you installed the GGC package (GGCDIR).
    1. Set the GGC and FGLGWS environment:
      • Run the envggc script ($GGCDIR/envggc or %GGCDIR%/envggc.bat) for your GGC installation.
      • Run the envcomp script ($FGLDIR/envcomp or %FGLDIR%/envcomp.bat) for your FGLGWS installation.

    2. Prepare the sample application by compiling the libraries, changing the binaries permissions (for Unix-like systems) and compiling the sample application.
      • UNIX® like OS: Run the build script.
        cd ${GGCDIR}
        ./build
      • Windows®: Run the build bat file.
        cd %GGCDIR%
        build.bat

      The ggc library and the Genero Archive file ggc-quick-start.gar are created, and the sample price application is now compiled.

  2. Start the Genero Desktop Client.
    For OS-specific instructions on starting the Genero Desktop Client, see the Genero Desktop Client User Guide.
    The Genero Desktop Client launches and you see the monitor screen.
  3. Record a GUI log.
    1. Create a directory for GUI logs.
      This example uses a directory named /myguilog_dir.
    2. Change to your myguilog_dir directory.
    3. Set the FGLIMAGEPATH environment for the price application.
      • UNIX like OS:
        export FGLIMAGEPATH=${GGCDIR}/src/quick-start/img:${FGLDIR}/lib/image2font.txt
      • Windows:
        set FGLIMAGEPATH=%GGCDIR%\src\quick-start\img;%FGLDIR%\lib\image2font.txt
    4. Run the price application to record your interaction with the GUI using one of the following commands.
      • UNIX like OS:
        fglrun --start-guilog=price_sample.guilog ${GGCDIR}/src/quick-start/price 
      • Windows:
        fglrun --start-guilog=price_sample.guilog %GGCDIR%\src\quick-start\price
      For more information on using --start-guilog, refer to the fglrun page of the Genero Business Development Language User Guide.
      The GDC opens the application in a system window.
      Figure: Price application run by GDC

      Price application running in GDC
    5. Execute some actions to record in the log, then close the application.

      For example, you can sort on the Product name or Price columns, and you can edit the price of items.

    The DVM generates the price_sample.guilog file.
  4. Generate a scenario from the guilog file.

    From the myguilog_dir directory, run the ggcgen bdl command to transform the DVM guilog into a BDL scenario.

    ggcgen bdl price_sample.guilog

    The file price_sample.4gl is the created test scenario.

  5. Compile the scenario and copy the file to the quick-start directory.
    1. Compile the scenario
      fglcomp price_sample.4gl
      The generated test scenario compiles and creates the application file price_sample.42m.
    2. Copy price_sample.42m to the quick-start directory.
  6. 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
  7. Run the test.
    1. Change to your quick-start directory.
      • UNIX like OS:
        cd ${GGCDIR}/src/quick-start
      • Windows:
        cd %GGCDIR%\src\quick-start
    2. Run the command to test the price application.
      fglrun price_sample tcp --command-line "fglrun price"

      Where the path to the test application (price_sample) and the application being tested (price) is the current working directory.

    The test runs, and the results display in the output.
    Figure: Output for the TCP test scenario (Windows)


    Note:

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

  8. With the test scenario complete, stop the GGC server.
    ggcadmin stopbdlserver

Run the test scenario with the application running on the GAS

Before you begin

This procedure assumes you completed the previous quick start, Run a test scenario using a direct connection.

You should have a Genero Archive file, ggc-quick-start.gar, in your $GGCDIR/src/quick-start directory. If you do not find this file, return to that procedure and complete its steps.

This procedure uses the test scenario generated in the procedure Run a test scenario using a direct connection. If you do not have the price_sample test scenario, return to that procedure and complete its steps.

This procedure requires two command line windows. To use one terminal window, you must run the GAS in the background; alternatively, you can open a separate terminal to start the GAS.

Steps

  1. In your first command line window, set the environment and start the GAS.
    1. Set the environment for both FGLGWS and the GAS:
      • Run the envcomp script ($FGLDIR/envcomp or %FGLDIR%/envcomp.bat) for your FGLGWS installation.
      • Run the envas script ($FGLASDIR/envas or %FGLASDIR%/envas.bat) for your GAS installation.
    2. Start the standalone GAS dispatcher:
      • UNIX like OS:
        httpdispatch &
      • Windows:
        httpdispatch
  2. In your second command line window, set the environment and deploy the application on the GAS.
    1. Set the environment for FGLGWS, GAS, and GGC
      • Run the envcomp script ($FGLDIR/envcomp or %FGLDIR%/envcomp.bat) for your FGLGWS installation.
      • Run the envas script ($FGLASDIR/envas or %FGLASDIR%/envas.bat) for your GAS installation.
      • Run the envggc script ($GGCDIR/envggc or %GGCDIR%/envggc.bat) for your GGC installation.
    2. Change to your quick-start directory.
      • UNIX like OS:
        cd ${GGCDIR}/src/quick-start
      • Windows:
        cd %GGCDIR%\src\quick-start
    3. Deploy the quick-start archive.
      Deploy the quick-start archive with the following gasadmin command:
      gasadmin gar --deploy-archive ggc-quick-start.gar
      A successful deployment returns this output (output may differ slightly depending on the platform).
      Archive ggc-quick-start.gar successfully deployed.
      Note:

      These instructions use the gasadmin command. If you have configured your GAS for the Deployment Application, you can use it instead. See the Genero Application Server User Guide for information on using the Deployment Application.

    4. Enable the quick-start archive.
      From the quick-start directory, run the following gasadmin command:
      gasadmin gar --enable-archive ggc-quick-start.gar
      If the archive is enabled, the following output is displayed (output may differ slightly depending on the platform):
      Archive ggc-quick-start.gar successfully enabled.
  3. Ensure the application works correctly.
    In a browser type the address:
    http://localhost:6394/ua/r/price
    You should see the "Product and prices" application open in your browser and be able to interact with it.
  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 compiled test scenario against the application running on the GAS.
    From the quick-start directory, run the following command:
    fglrun price_sample.42m ua --url http://localhost:6394/ua/r/price
    The test runs, and the results display in the output.
    Figure: Output for the TCP test scenario


    Note:

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

  6. With the test scenario complete, stop the GGC server.
    ggcadmin stopbdlserver