offline

Offline means generating a test sequence once, that can be later run automatically. Or, just generating a sequence to prove that the model with the path generator(s) together with the stop condition(s) works.

The syntax is:

gw3 GLOBAL_OPTIONS offline OPTIONS -m <model-file> "GENERATOR(STOP_CONDITION)"

Please note that the “GENERATOR(STOP_CONDITION)” should be enclosed with double-quotes.

Options

  • --json, -j
    Returns data formatted as json.
    Default is true

  • --model, -m
    The model, as a graphml file followed by generator with stop condition.
    This options can occur multiple times.
    Read more about path generators and stop conditions

  • --unvisited, -u
    Will also print the remaining unvisited elements in the model.
    Default is false.

  • --verbose, -o
    Will print more details
    Default is false.

Example:

gw3 offline -m model.graphml "random(edge_coverage(100))"

The above should be read like: Use the model model.graphml, and generate a path using the random path generator, and stop when the edge coverage is 100%

Example:

Using an offline sequence in a test,where the model used in this example is from the Introduction page.

gw3 offline -m Login.graphml "a_star(reached_vertex(v_Browse))"
{"currentElementName":"e_Init"}
{"currentElementName":"v_ClientNotRunning"}
{"currentElementName":"e_StartClient"}
{"currentElementName":"v_LoginPrompted"}
{"currentElementName":"e_ValidPremiumCredentials"}
{"currentElementName":"v_Browse"}

To get the element names only, run:
The jq program is form here: https://stedolan.github.io/jq/

gw3 offline -m Login.graphml "a_star(reached_vertex(v_Browse)) | jq -r '.currentElementName'"
e_Init
v_ClientNotRunning
e_StartClient
v_LoginPrompted
e_ValidPremiumCredentials
v_Browse

If your test was written in java, you could put the sequence in a unit test like this:

@Test
public void Login_Smoke_Test() {
  e_Init();
  v_ClientNotRunning();
  e_StartClient();
  v_LoginPrompted();
  e_ValidPremiumCredentials();
  v_Browse
}
Tags: