Includes, Params & Rows

4files
1figure
2min read
Sheet 17 of 47 · Scenarios

Filesscenarios/lib/zombies.yml · scenarios/zombies-menus.yml · zombies-menus.yml · zombies.yml

Filescenarios/lib/zombies.ymlFilescenarios/zombies-menus.ymlSteps that every file repeats, like logging in or opening a menu, go into a shared file once. Parameters fill in what differs, and rows run the same file once per value.

A shared file and a file that uses it

scenarios/lib/zombies.yml
params: {wait: 500}
define:
  open_gui:
    params: {gui: null, expect: gui-test}   # null means required
    steps:
      - {do: chat, c: "/zadmin gui ${gui}"}
      - {do: expectWindow, title: "${expect}", timeout: 4000}
  leave:
    - {do: close}
    - {do: expectNoWindow}
steps:
  - {do: join}
  - {do: wait, ms: "${wait}"}
scenarios/zombies-menus.yml
name: zombies menus
bot: EventBot
include: [zombies.yml]
params: {gui: null, slot: 10}
matrix:
  gui: [creator-main, enemy-creator-main]
steps:
  - {do: include, file: zombies.yml, with: {wait: 800}}
  - {do: call, name: open_gui, with: {gui: "${gui}"}}
  - {do: expectSlot, slot: "${slot}"}
  - {do: call, name: leave}
  - {do: quit}

Filezombies-menus.ymlFilezombies.ymlzombies-menus.yml runs twice, once with gui set to creator-main and once with enemy-creator-main. Each run plays the steps of zombies.yml with wait at 800, opens the menu through open_gui, checks slot 10 and leaves through leave.

Include and call

  • include: at the top pulls in the define groups of other files. Their steps do not run.
  • {do: include, file: x.yml, with: {...}} runs that file's steps in place, with its own params.
  • define names step groups, either a plain list or {params, steps}.
  • {do: call, name: login, with: {...}} runs one group. Groups can call other groups.

Params

params is a list of required names, or a map of name to default where null means required.

  • Values replace ${name} before the run.
  • A value that is the whole string keeps its type, so times: "${n}" stays a number.
  • Params also become vars.
  • ${...} names that are not params are left for the run, as before.

The # key on the Scenarios page writes a param for you, see Editing Steps.

Rows

KeyRuns the scenario
matrix: {a: [..], b: [..]}Once for every combination
each: [{..}, {..}]Once per row
each: rows.csvOnce per CSV line, with the header naming the params

Rows are named like zombies menus [gui=creator-main]. CI mode reports every row on its own. The API and the Scenarios page run all rows as one scenario with a group per row.

Two values for one variable: the file runs once for each.
The Variables bar on the Scenarios page holding creator-main and nope-menu for gui, with the line Runs 2 times, once for each value

Where files are looked up

Files are looked up next to the file that asks, then in the lib folder next to the scenario. For the API and the Scenarios page that is the scenario folder's lib. CI mode does not run the files in lib.

Mistakes fail early

These fail before anything runs:

  • a missing or unknown param
  • an unknown group
  • a file that is not there
  • include or call cycles, reported as call cycle: a -> b -> a

Loading the index

Enter openUp Down moveEsc close