Skip to content
Dezmerean Robert edited this page Feb 27, 2022 · 10 revisions

Offline means generating a test sequence once that can later be 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:

java -jar graphwalker-cli-4.3.1.jar GLOBAL_OPTIONS offline OPTIONS -m <model-file> "GENERATOR(STOP_CONDITION)"

Please note that the "GENERATOR(STOP_CONDITION)" should be enclosed within double-quotes.

Options

  • --model, -m

    The model, as a graphml file, followed by generator with stop condition.
    This option can occur multiple times.

    Read more about path generators and stop conditions.

  • --unvisited, -u

    Will print the remaining unvisited elements in the model.
    Default is false.

  • --verbose, -o

    Will print more details
    Default is false.

  • --blocked, -b

    This option enables or disables the BLOCKED feature. When -b true GraphWalker will filter out elements in models with the keyword BLOCKED. When -b false GraphWalker will not filter out any elements in models with the keyword BLOCKED.
    Default is true.

  • --seed, -s

    This option seeds the random generator with the provide number. Using a seeded number, will generate the same path every time it's run.

Example:

java -jar graphwalker-cli-4.3.1.jar offline -m model.graphml "random(edge_coverage(100))"

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

Example:

Using an offline sequence in a test, where the model is from the home page.

java -jar graphwalker-cli-4.3.1.jar 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 from here: https://stedolan.github.io/jq/

java -jar graphwalker-cli-4.3.1.jar 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:

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

Example:

Seeding a test with a number.

java -jar graphwalker-cli-4.3.1.jar offline --seed 147945811993279 --model model.json "random(edge_coverage(100))"
Clone this wiki locally