CI Mode
Fileplugins/IgniteTestAgent/config.ymlFiledocs/ci-example.ymlCI mode runs scenarios with no window: start a Paper server, join the bots, play every scenario file, write JUnit XML and an HTML report, stop the server and exit with a code a pipeline can read. The same jar does it, CI mode starts when the command line has --run-scenario or --crawl.
java -jar IgniteTestTool.jar --run-scenario tests/scenarios --server-dir server --start-server --junit build/itt/junit.xml --timeout 10mWhat a run does
- No window opens. Every step prints as it finishes, and a summary with each failure follows.
--quietprints failed steps only. - Bots disconnect between scenarios, so each file starts from a clean join. A matrix file runs once per row, and each row is its own test suite.
--run-scenariocan be left out when--crawlis given. The crawl is a test suite of its own with crawl errors as skipped notes, and the visual check is one more suite with a test case per screen.- On GitHub Actions the summary also goes to the job summary page.
- A failed step keeps what its bot looked like at that moment, and CI mode prints it under the failed step.
Exit codes
| Code | When |
|---|---|
0 | Every scenario passed |
1 | Any scenario failed, the server did not start or a file did not parse |
2 | Bad command line |
3 | Not licensed, see License |
License
CI mode needs the license key in ITT_LICENSE. With it the run takes the license's shared CI slot, which every runner shares and which does not count against your computers. Store the key as a secret of the CI job. Without ITT_LICENSE the run falls back to the activation saved on that computer, so it works on your own machine; a fresh runner has none and stops before anything starts:
Not licensed: set ITT_LICENSE to your license key, as a secret of the CI job.
Server errors
CI mode watches the managed server by itself, or --server-log, or logs/latest.log in --server-dir. Each error group becomes a failing test case in the JUnit XML with the trace as its body, and a line in the summary. --ignore-exceptions <regex> (can repeat) allows errors for every scenario, --no-watch turns it off. See Server Watcher.
Takeover in CI
takeover steps work in CI when the job runs in a desktop session: a self-hosted Windows runner logged in as a user, not a service. A hosted runner has no display and the step fails with that reason. Every takeover is released when the run ends or hits --timeout. See Takeover.
Options
Times take a unit: 500ms, 90s, 10m, 1h.
Options that need other options
A run that breaks one of these stops before anything starts, with exit code 2.
| Option | Needs |
|---|---|
--start-server | --server-dir |
--plugin, --install-agent | --server-dir |
--cache | --server-dir |
--op, --op-bots | --start-server |
--code-coverage | --start-server |
--workers | --run-scenario and --start-server. Cannot be combined with --shard or --crawl |
--visual-baseline | --crawl |
--update-baseline | --visual-baseline |
--report-embed | --report-html |
Scenarios and server
| Option | Meaning |
|---|---|
--run-scenario <file or dir> | one scenario, or every .json, .yml and .yaml in the folder, in name order |
--server-dir <dir> | the Paper server folder. Bots join its server-port |
--server-jar <file> | default paper.jar, or the only jar in the folder |
--start-server | start the server first, wait for its Done line, stop it at the end |
--server-timeout <time> | how long the start may take, default 5m |
--timeout <time> | limit for the whole run, default 10m |
--host, --port | where bots join, default 127.0.0.1 and the server's port |
--data-dir <dir> | default a fresh temp folder, so a running tool is never in the way |
--api-port <port> | also serve the HTTP API during the run; set ITT_API_TOKEN so your scripts know the token |
--java <path>, --server-memory <size> | java and -Xmx for the server, default this JVM and 2G |
--plugin <jar or dir> | copy a plugin jar, or every jar in a folder, into plugins/ before the start, can repeat. Needs --server-dir |
--op-bots <a,b> | with --start-server, op these names from the console once the server is up |
--files <a.yml,b.yml> | run only these files of the folder, plus its setup files. This is how a worker gets its share |
Reports
| Option | Meaning |
|---|---|
--junit <file> | JUnit XML, one test suite per scenario and one test case per step |
--summary <file> | the readable summary as a file too |
--report-html <file> | an HTML page with every scenario, its steps (failed ones open), server errors and a gallery of the captures. Images are copied to <name>-captures/ next to it |
--report-embed | put the images into the HTML page as base64, one file to attach. Needs --report-html |
--captures <dir> | where screenshot and record steps save, one folder per scenario file. Default captures next to --junit, else in the data dir |
--quiet | print failed steps only. Without it every step is a line, which a script or an agent reading the output pays for |
Server errors
| Option | Meaning |
|---|---|
--server-log <file> | server log to watch for errors, default the managed console or logs/latest.log |
--ignore-exceptions <regex> | server errors that do not fail a scenario, can repeat |
--no-watch | do not fail scenarios on server errors |
Server side
| Option | Meaning |
|---|---|
--install-agent | put IgniteTestAgent into plugins/ for server and assertServer steps. Needs --server-dir |
--agent-url <url> | where the agent listens, default http://127.0.0.1:8768. For a server on another machine see Remote server |
--agent-token <token> | the agent's token, default read from plugins/IgniteTestAgent/config.yml in --server-dir; --install-agent writes a matching one |
--rcon-password <pw> | RCON for rcon steps, the port comes from rcon.port in server.properties |
Crawl and visual check
| Option | Meaning |
|---|---|
--crawl <params> | crawl menus after the scenarios, /crawl parameters as key=value pairs split by &, like "root=/is&depth=3" |
--crawl-bot <name> | the bot that crawls, default CrawlBot. It needs the permissions the menus ask for |
--op | with --start-server, op the crawl bot from the server console first |
--visual-baseline <dir> | render the crawled screens and fail on changes, see Visual regression. Needs --crawl |
--update-baseline | write the renders as the new baseline instead of failing. Needs --visual-baseline |
--render-url <url> | GUI Studio render API, default https://ignitedstudios.dev |
--visual-report <dir> | where the before, after and diff images and index.html go, default visual-report |
--visual-tolerance <percent> | changed pixels a screen may have, default 0 |
Cache, coverage and splitting
| Option | Meaning |
|---|---|
--cache <file> | the result cache in that file. Scenario files that passed before against the same text, includes and jars are reported as passed without running, and when every file is unchanged the server is not started at all. Needs --server-dir |
--code-coverage <dir> | measure line coverage of the plugins and write coverage.txt and jacoco.exec there; with --cache a file is also skipped when a new build changed no method it runs. Needs --start-server |
--coverage-plugins <a,b> | parts of the jar names to measure, default the --plugin jars or every plugin |
--shard <i/n> | run every n-th scenario file starting with the i-th. Three runs with 1/3, 2/3 and 3/3 against three servers cover a folder between them |
--workers <n> | do that split in one command: n copies of --server-dir, each with its own ports, each run by its own tool process, at the same time. With --cache the split goes by how long each file took last time, so one slow file does not hold a whole worker's share back. Needs --run-scenario and --start-server, cannot be combined with --shard or --crawl |
--keep-workers | leave those copies on disk afterwards |
--workers-dir <dir> | where the copies go. By default a folder next to the server folder, so they land on the same drive and the server's own jars are hard links instead of copies |
More on shards, workers and setup: true files on Short Loop & Result Cache.
GitHub Actions
Filedocs/ci-example.ymlA workflow a plugin repo can copy: build the plugin, download Paper, run the scenarios, keep the reports. It runs on Windows because the tool's process guard (job object) is Windows only. It needs two repository secrets: ITT_JAR_URL, the download link of your IgniteTestTool jar, and ITT_LICENSE, your license key. Without the key the run exits with code 3 before any scenario runs. The same file ships as docs/ci-example.yml in the tool's repository.
# Sample GitHub Actions workflow for a plugin repo. Copy it to .github/workflows/menus.yml in the plugin
# repo and adjust the paths. It builds the plugin, starts a Paper server with it and runs the scenarios in
# tests/scenarios with IgniteTestTool bots. A failing step fails the job and shows up in the test report.
#
# Runs on Windows because the tool's process guard (job object) is Windows only.
#
# Two repository secrets: ITT_JAR_URL, a download link for the IgniteTestTool jar, and ITT_LICENSE, your license
# key. The key takes the license's shared CI slot; without it the run exits with code 3 before any scenario runs.
name: Menu tests
on:
push:
pull_request:
jobs:
scenarios:
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build the plugin
run: ./gradlew --no-daemon shadowJar
- name: Prepare a Paper 1.21.11 server
shell: bash
run: |
mkdir -p server/plugins
build=$(curl -s -A "menu-tests/1.0" https://fill.papermc.io/v3/projects/paper/versions/1.21.11/builds/latest)
url=$(echo "$build" | python -c "import sys,json;print(json.load(sys.stdin)['downloads']['server:default']['url'])")
curl -s -o server/paper.jar "$url"
cp build/libs/*-all.jar server/plugins/ 2>/dev/null || cp build/libs/*.jar server/plugins/
echo "eula=true" > server/eula.txt
printf 'online-mode=false\nserver-port=25590\ndifficulty=peaceful\nlevel-type=minecraft\\:flat\nspawn-protection=0\n' > server/server.properties
# bots that run admin menus need op, the server reads ops.json on start
echo '[{"uuid":"'"$(python -c "import uuid,hashlib;h=bytearray(hashlib.md5(b'OfflinePlayer:TestBot').digest());h[6]=h[6]&0x0f|0x30;h[8]=h[8]&0x3f|0x80;print(uuid.UUID(bytes=bytes(h)))")"'","name":"TestBot","level":4,"bypassesPlayerLimit":false}]' > server/ops.json
# put the download link of your IgniteTestTool jar in the ITT_JAR_URL repository secret
- name: Get IgniteTestTool
shell: bash
env:
ITT_JAR_URL: ${{ secrets.ITT_JAR_URL }}
run: curl -sL -o itt.jar "$ITT_JAR_URL"
- name: Run the scenarios
env:
ITT_LICENSE: ${{ secrets.ITT_LICENSE }}
run: >
java -jar itt.jar
--run-scenario tests/scenarios
--server-dir server --start-server
--junit build/itt/junit.xml
--summary build/itt/summary.txt
--timeout 10m
- name: Keep the reports and the server log
if: always()
uses: actions/upload-artifact@v4
with:
name: menu-tests
path: |
build/itt/
server/logs/latest.log
- name: Publish the test report
if: always()
uses: mikepenz/action-junit-report@v5
with:
report_paths: build/itt/junit.xml