How to compile and run Java tests

This topic provides information about how to compile and run your own tests.

About this task

The procedure in this topic shows you how to compile and run Java tests you have developed.

Before you begin:
  • It is assumed that you have built two new test java files:
    • One SessionManager implementation named, for example, mySessionManager.java that will manage the testing session
    • One Scenario implementation named, for example, myScenario.java that will instantiate real scenarios based on the application launched by the GAS
  • It is assumed that your new test java files are in the package path.to.myTests and therefore you have placed them in the directory path/to/myTests.
  • It is assumed your environment is configured to run Java and the GGC, see Configure your environment for Ghost Client.
  • If you are using the GAS:
    • Make sure your GAS version is at least version 2.50.34 or greater.
    • Make sure that the standalone dispatcher httpdispatch see Dispatcher: httpdispatch is started and that you can access the GAS demos welcome page, http://localhost:6394/demos.html, from your browser.
  1. To compile your newly created tests, type the following:

    javac path/to/myTests/*.java

  2. To run the tests through the GAS using the application URL, type the command:

    java com.fourjs.ggc.Launcher -u http://localhost:6394/ua/r/myApplication -s path.to.myTests.mySessionManager

    Tip: Depending on the user agent protocol you provide in the URL, you can specify what front-end the test is to be run as:
    • /ua/r/; for version 3 clients: Genero Web Client for JavaScript (GWC-JS), GDC 3.00, GMA, or GMI - UAProxy.
    • /ja/r/; for Genero Desktop Client (GDC 2.50) - GDCProxy.
    • /wa/r/; for Genero Web Client for HTML5 (GWC-HTML5) - HTML5Proxy.

Or alternatively you can run the test in direct connection mode without using the GAS.

  1. To run the tests using a stand-alone DVM, type the command:

    java com.fourjs.ggc.Launcher -s path.to.myTests.mySessionManager --command "fglrun myApplication"

    Note: The DVM command line to launch the application just needs to be passed in double quotes, for example " fglrun myApplication".