ALEX CLI

ALEX offers a command line interface (cli) for executing tests and starting learning experiments from the command line. Here, we show how to use it in both cases.

Prerequisites

First, all dependencies for the cli have to be installed. From the root of the repository execute the following commands:

cd cli/src/main/javascript
npm install

Furthermore, make sure that the backend of ALEX is running. Look at the start page of this documentation to get instructions for how to run ALEX.

Executing Integration Tests

For executing tests from the cli, you need three files:

  1. A JSON file with exported symbols
  2. A JSON file with exported test cases
  3. A JSON file that contains the configuration for the web driver

You can obtain (1) and (2) by exporting the symbols and test cases in the frontend of ALEX. The file for (3) may look like this:

// config.testing.json
{
  "browser": "chrome",
  "width": 1280,
  "height": 720,
  "headless": true
}
Property Description
browser The browser to run the tests in. Allowed values: chrome, edge, firefox, html_unit, remote, safari
width The width of the browser. If set to 0, the default width is used.
height The height of the browser. If set to 0, the default width is used.
headless If the browser should run in headless mode. Make sure the browser supports that. It is ignored otherwise.

The cli itself can be found at cli/src/main/javascript. Here, execute node alex-cli.js -h to get a list of all parameters. An exemplary call for executing tests would be:

node alex-cli.js --uri "http://localhost:8000" \
                 --target "https://www.google.com" \
                 -a "test" \
                 -u "admin@alex.example:admin" \
                 -s "/home/alex/google.symbols.json" \
                 -t "/home/alex/google.tests.json" \
                 -c "/home/alex/config.test.json"

Finally, the project that has been created automatically during the testing, is deleted.

Starting Learning Experiments

You can also run learning experiments with the cli. The only difference is that the configuration file is a little more complex. An example configuration file would look like this:

// config.learning.json
{
    "algorithm": {
        "name": "TTT"
    },
    "browser": {
        "driver": "chrome",
        "width": 1280,
        "height": 720,
        "headless": true
    },
    "comment" : "",
    "eqOracle": {
        "type": "random_word",
        "minLength": 1,
        "maxLength": 1,
        "maxNoOfTests": 1,
        "seed": 42
    },
    "maxAmountOfStepsToLearn" : -1,
    "resetSymbol": "Reset",
    "symbols": ["Search Term", "Website in Results?", "Next Page"],
    "useMQCache": true
}
Property Description
algorithm The algorithm to use. The name may be one of the following values: DHC, DT, KEARNS_VAZIRANI, LSTAR, TTT.
browser Analogue to above.
comment A comment for the process.
eqOracle The equivalence oracle to use.
maxAmountOfStepsToLearn After which step the learner should stop learning. -1 means never.
resetSymbol The name of the symbol that should be used for the reset. Make sure that the name exists in the file that contains the symbols.
symbols The names of the symbols that should used for learning. Make sure that the name exists in the file that contains the symbols.
useMQCache If membership queries should be cached.

An exemplary call would be:

node alex-cli.js --uri "http://localhost:8000" \
                 --target "https://www.google.com" \
                 -a "learn" \
                 -u "admin@alex.example:admin" \
                 -s "/home/alex/google.symbols.json" \
                 -c "/home/alex/config.learn.json"

where the parameter -t is omitted. Note that, contrary to testing, the project is not deleted. Once ALEX has finished learning an application, the control is given back to the user. Since the results of a learning process are not really readable on the command line, a user has to look a the results via the frontend of ALEX.

results matching ""

    No results matching ""