Step Reference
Filescenarios/30-shop.ymlEvery step a scenario can take, with its parameters. This is the one-page guide the tool prints with java -jar IgniteTestTool.jar guide, sorted by what a step is for. The long form of each part is on the other Scenarios sheets.
A whole file
name: shop buys a sword
bot: Buyer
include: [common.yml] # define groups from lib/common.yml, looked up next to the file and in lib/
vars: {price: 150}
cache: {inputs: [plugins/Shop/config.yml]}
ignoreExceptions: ["Known noisy warning"]
steps:
- {do: join}
- {do: rcon, cmd: "eco set ${bot} 500", expect: "500"}
- {do: chat, c: /shop}
- {do: expectWindow, title: "(?i)shop", timeout: 4000}
- {do: click, custom: "(?i)iron sword", expectWindow: "(?i)confirm"}
- {do: click, slot: 11}
- {do: expectChat, regex: "bought .* for (?<paid>\\d+)"}
- {do: set, var: left, calc: "500 - ${paid}"}
- {do: assertServer, path: player, player: "${bot}", field: "inventory[0].type", value: IRON_SWORD, timeout: 2000}
- {do: rcon, cmd: "eco get ${bot}", expect: "${left}"}
finally:
- {do: call, name: reset_player}
- {do: quit}Top of the file
| Key | What it does |
|---|---|
name | The scenario's name |
bot | The bot that runs the steps |
include | Pulls in the define groups of other files, looked up next to the file and in lib/ |
vars | Variables for the file, vars: {price: 150} |
params | Names the file needs: a list of required names, or a map of name to default where null means required. Values replace ${name} before the run and also become vars |
ignoreExceptions | Server errors this file may log without failing, while the server watcher runs |
cache | cache: {inputs: [..]} adds files the result cache watches, cache: {ignore: [..]} drops one, cache: false opts the file out |
steps | The steps |
finally | Runs whatever failed before it. Calls and groups inside it run to the end too |
setup: true | Marks a file that prepares the server for the others: every shard and worker runs it first and the cache never skips it |
checkpoint: clean | Puts the saved copy of plugin data called clean back before the file runs, with a server restart |
freshPlayers: true | fresh: true on every join |
define | Named step groups, see Library |
matrix, each | Run the file once per row, see Library |
join on a bot an earlier run left online lets go of its keys, closes its menu and counts chat from that moment.
Bot actions
| Step | Parameters |
|---|---|
join, quit | host, port, account; fresh: true resets health, hunger, items, effects and levels, freshPlayers: true at the top of the file does it for every join |
chat | c (text or /command), wait, until (regex, returns early) |
click | One of slot, item or custom (regex on the name) is required, lore only narrows the match; button, shift, expectWindow |
close | |
goto | x, y, z; like every action that takes a position, ~ is the block the bot stands in and ~2 counts from it |
wait | ms |
action | action plus its own parameters, as + field keep the answer; call actions lists them all |
answerDialog | button, inputs, expectWindow |
Expectations
| Step | Parameters |
|---|---|
expectWindow, expectNoWindow | title (regex), timeout |
expectSlot | slot, item, custom, lore, count, glint, nameRuns, timeout; absent: true passes when no slot matches |
expectTitle | title, color, bold, ... |
expectChat, expectNoChat | regex, timeout / window, since: step|scenario|now; named groups become variables |
expectDialog | title, type, inputs, buttons |
assertPos | x, y, z, range, timeout |
expectServer | name (regex on the backend behind a proxy), probe: true asks the proxy with /server, timeout (default 10000) |
Style checks on titles, names and lore, and dialogs, are on Styles & Dialogs.
Server
| Step | Parameters |
|---|---|
rcon | cmd, expect (regex), as |
server | path (an agent endpoint) plus its parameters, as + field; params: {name: .., action: .., cmd: ..} for the three names a step keeps for itself; x, y, z take ~ too |
assertServer | path, field (dotted, [n], pdc.ns:key, inventory.size counts a list), op (eq ne gt ge lt le contains matches exists absent), value, delta, timeout |
file | path in the server folder, then replace (regex) + with, write, append, expect (regex, polls until timeout) + as, or restore: true. Every file a scenario changed is put back when it ends, keep: true leaves the edit |
checkpoint | save: name or restore: name; paths in the server folder (default the data folder of every plugin). The server restarts around it and the bots have to join again, live: true copies under a running server |
server and assertServer need the server agent, except for mongo and redis. Saved copies of plugin data are on Checkpoints.
Control flow
| Step | Parameters |
|---|---|
set | var + value, var + calc (+ - * / % and brackets), or vars: {a: 1} |
loop | times, with steps. With until: pass it tries until one iteration gets through and fails when none of times does |
group | steps |
parallel | bots (count or names), with steps |
if | check (any step), then, else: a check that does not pass takes the else branch, it is not a failure |
log | message |
call | name, with: runs a group from define |
include | file, with: runs another file's steps in place |
Pictures
| Step | Parameters |
|---|---|
takeover, frame, key, screenshot, record, release | Real client pictures, see Screenshots in Scenarios |
Every step
Any step takes optional: true, bot: <name> and name: <label>.
${var} works in every string. These are set for you:
| Variable | Set by |
|---|---|
${bot} | The bot running the step |
${i} | loop |
${n} | parallel |
${slot} | expectSlot |
${match} | expectChat |
Library
define: {name: [steps]} or {name: {params: {a: null}, steps: [...]}} names a group of steps. A group is used with {do: call, name: x, with: {a: 1}}. {do: include, file: x.yml} runs another file's steps in place. matrix: {a: [1, 2]} or each: rows.csv runs the file once per row. The full rules are on Includes, Params & Rows.
Bot actions used most
These go in an action step as action: <name>.
| Action | Parameters and notes |
|---|---|
sneak | on |
hotbar | slot |
use | One right click. swing: 1 adds the arm swing |
useHold | ms. A held key clicks again every 200 ms unless the item is a bow, food or shield, every: 0 forces one click |
attack | id |
look | x y z |
place | |
dig | |
equip | item |
drop | |
inv | full=1 |
hud | Action bar, title, boss bars |
advancements | match. What the player holds, a plugin's toast included |
resourcePacks | What the server pushed. answer=accept|decline|fail|ignore for the next one |
mark | Take one before waitFor |
waitFor | type=chat|actionbar|title|sound|advancement|resourcepack|packet|entity|entityGone|move, match, since, timeout; absent: 1 passes when nothing matched in that time |
call actions lists every action. The ones for exact numbers are on Precise Testing.
Server side
IgniteTestAgent answers what a bot cannot see, as call server/<endpoint> or a server / assertServer step.
| Endpoint | Parameters and notes |
|---|---|
player | player= |
entity | player= / uuid= / id= |
entities | near=, r=, type= |
entity/set | |
dummy | A target with known health |
dummy/clear | |
block | world, x, y, z. A chest, sign, spawner or skull also has state with its items, front, pdc |
snapshot, restore | A box of blocks by name |
exec | cmd, console output back |
tick | action=freeze|unfreeze|step|rate |
health | TPS |
commands | |
ping | |
player/reset | |
placeholder | text=%x%, player= |
permission | player=, node= or prefix= |
events/watch | type=PlayerInteractEvent,full.class.Name. Records Bukkit events |
events | since=<mark>, type=, player=. Lists them with cancelled and their getters, events.size counts them |
inspect | plugin=, path=. Reads a plugin's own state by getter or field name |
invoke | plugin=, path=, method=, args=a,b or a JSON array. Calls a method on what the path leads to |
sql | url=jdbc:sqlite:plugins/Shop/data.db, or a MySQL url with user and password; query=. Answers count and rows, or updated |
mongo and redis work the same way in a server or assertServer step, but the tool answers them itself, no agent needed:
| Endpoint | Parameters and notes |
|---|---|
mongo | uri, db, collection, filter, sort, max; insert, update, delete: true |
redis | host, port, password, db, command: "HGET player:Steve coins", answer in value |
inspect paths look like path=arenaService.arenas[IttArena].state: [n] for lists, .size to count, a player name finds a UUID key. No path shows the plugin's fields, a wrong name lists what is there. Use it before writing a helper plugin.
invoke picks the overload by what the arguments fit: numbers, booleans, enum names, a player name, a world, world:x:y:z. type=com.acme.Shop on inspect and invoke starts at the static side of a class, on=async keeps a slow call off the server thread.
sql, mongo and redis poll in assertServer like anything else:
- {do: assertServer, path: sql, url: .., query: "select coins from players where name = 'Steve'", field: "rows[0].coins", value: 150, timeout: 3000}More on Databases & Plugin Calls.
Running from a script
ITT="java -jar IgniteTestTool.jar" # add --data-dir <dir> when the tool runs with one
$ITT check suite/ # parse only, finds typos in under a second
$ITT run suite/ --cache # runs what changed, skips what already passed
$ITT run suite/30-shop.yml # one file, always runs
$ITT run suite/ --failed # only what failed last time
$ITT run suite/ --cache --deploy # build, swap the jar, restart the server, then run
$ITT last # the last report again
$ITT call rcon c="list" # any endpoint, parameters as key=value
$ITT usage # calls and bytes per endpoint, what the session cost so far
$ITT coverage # line coverage of the plugin, coverage <Class> for its missed lines
$ITT panel # the same in a browser tabrun prints one line per file and, under a failed one, the step, the three steps before it, what the bot saw (position, health, held item, open window, last chat lines) and the server errors logged meanwhile. The first word is PASS or FAIL and the exit code follows it. That report is meant to be enough: read it before asking the server or the bot anything else.
Rules that keep a session short:
- Run a folder with
--cacheinstead of picking files by hand. A file is skipped when it passed and nothing it depends on changed: its own text, the files it includes, the jars in the server folder and inplugins/, and the config files of the server and its plugins. A config edited by hand brings the file back and the report names it.cache: {inputs: [..]}adds other files,cache: {ignore: [..]}drops one,cache: falseopts a file out,call cache/clearforgets everything. - With code coverage on (
call coverage/code/on plugins=<part of the jar name>, then restart the server) a pass also holds through a new build that changed no method the file ran.run --cache --deploythen reruns only the files an edit can reach, and the report saysnew build, no method it runs changedfor the rest. callcuts every list at 100 items and text at 4000 characters. Ask for less:fields=type,health,pos.ykeeps those keys of every row,cap=5shortens lists and maps,--fulllifts the limit.usageshows which endpoint cost the most.checkknows the bot actions and the agent endpoints. A typo inaction:orpath:fails there, with the closest name, instead of minutes into a run.--deployneeds the project set once:call workflow/set deployProject=<dir> deployBuild="gradlew build" deployArtifacts="build/libs/*.jar". A failed build prints its error lines and nothing runs.- Do not sleep.
expectChat,expectWindow,expectSlot,assertServerandassertPospoll until theirtimeout,action: waitForblocks on an event.waitis for a cooldown the plugin really has. - Do not read the server log for errors. With
call watch/starton, a stack trace during a scenario fails it and shows up in the report with the plugin it came from. - Probing by hand is for finding out how something behaves, a few calls at most. Put several into one request:
POST /batchwith[{"path": "/chat", "params": {...}}, ...].
Other endpoints
| Endpoint | What it is for |
|---|---|
status, bots, processes | What is running |
start what=server, stop id=, console c= | The managed server |
join name=, quit bot=, chat bot= c=, win bot=, click bot= slot=, act bot= action= | One bot by hand |
suite/run, suite/check, suite/last, suite/status, suite/cancel | What the commands above call; format=text gives the short report |
history file=, flaky file= | Past runs of one file, steps that fail only sometimes |
cache, cache/clear | What the result cache holds |
usage, usage/clear | Calls, bytes and rough tokens per endpoint |
coverage/code (class=), coverage/code/on plugins=, coverage/code/off, coverage/code/reset | Line coverage of the plugin jars |
checkpoint, checkpoint/save name= paths=, checkpoint/restore name=, checkpoint/drop name= | Saved copies of plugin data |
deploy, deploy/status, workflow, workflow/set | Build and swap the plugin jar |
watch/start, watch/status | Server error watcher |
crawl, fuzz/start, load/start, soak/start | Long jobs, only when asked for |