Guides/15

Game tests

Test a mod in Fallout 4 from the command line, with no control of the desktop.

esx probe runs a test copy of Fallout 4 and checks your mod in the game. An optional F4SE plugin, the probe, runs in the game process and obeys requests from esx. A test reads the ammunition count, the animation events, the clips that play, the graph files, the camera and the player model. It can take a screenshot. It sends no key and no mouse input. With --display headless, the default, no window opens on your desktop: Linux uses a headless gamescope, and native Windows uses a desktop that gets no input. --display inherit opens a game window.

On Linux the game runs with Proton, for Fallout 4 runtime 1.11.240. On native Windows it runs with a launch helper and a guard library.

Native Windows

Native Windows tests has the build of the helper, the paths and the limits. The differences from Linux:

  • The test folder has independent copies of the game files, not links. Start from a vanilla copy of the game, and keep the installed game in a different folder.
  • The probe files are in LOCALAPPDATA/esx/probe. The saves are in the test profile, below share/compatdata/user.
  • The install also puts the Papyrus files of your F4SE into the test folder and into its manifest.
  • With --display headless the game has its window on a desktop that gets no input.
  • The test folder has the file steam_appid.txt, so that the game does not start again through Steam. The game uses the normal Steam client and your license.

The commands of this page are the commands on Linux. Windows has the same commands.

What you supply

Part Where you get it
F4SE for your runtime The F4SE site links to the download. Runtime 1.11.240 needs build 0.7.9.
Address Library for F4SE Plugins The file for your runtime, for example version-1-11-240-0.bin.
The probe DLL Build it from the probe folder of the esx repository. probe/README.md has the steps.
gamescope (Linux only) Your distribution has a package. It gives the headless display. Native Windows uses its helper.
A test world (optional) A plugin with a clean cell for pictures, as a ZIP file or a folder. esx has none in its repository. This guide uses the archive TestWorldspace.zip with the cell WeapTest.

esx downloads nothing. No release of the DLL exists yet, so the install needs --allow-unverified-dll.

Install

esx probe doctor
esx probe install --f4se ~/Downloads/f4se_0_07_09.7z \
                  --address-library ~/Downloads/AddressLibrary.zip \
                  --dll probe/build/esx-probe.dll --allow-unverified-dll

doctor writes nothing. It shows the runtime, the F4SE build that the runtime needs and each missing part.

install does not change your installed game. Each file goes into a test folder that esx owns, in ~/.local/share/esx/probe. The test folder has a link for each file of the game, then F4SE, the Address Library file and the probe. The game runs there in a Proton prefix of its own, with its own INI files, plugin list and saves. esx-probe-manifest.json in the test folder lists each installed file with its SHA-256. esx probe uninstall removes them.

If Steam has no single Proton version selected for the game, add --proton DIR to start and run.

Install a test world

A test world gives each game test the same clean cell. --world takes a ZIP file or a folder with one plugin and its loose files, relative to Data.

esx probe install --world ~/Downloads/TestWorldspace.zip
esx probe status
  • The plugin and each loose file go into Data of the test folder: 5 files for TestWorldspace.zip. The manifest lists each file with its SHA-256 and the source Test world (TestWorldspace.zip).
  • The cell of the world is the one cell of the plugin that has an EditorID: WeapTest for TestWorldspace.esp. If the plugin has no such cell or more than one, the command fails with WORLD_CELL_NEEDED and lists the cells. Then give --world-cell ID.
  • The manifest keeps the plugin name and the cell in world. installs[0].world of esx probe status shows them.
  • Each session activates the plugin of the world before the plugins of your mod. The files of the world stay in the test folder when a session stops.
  • A game test with no cell starts in the cell of the world. --cell ID and the key cell of a plan select another cell, for example QASmoke.
  • --world works alone and with the other inputs of install. A second install --world replaces the world.
  • esx probe uninstall --world removes only the world. esx probe uninstall removes it with each other file of the manifest.

The command refuses an archive that has an entry with .. or an absolute path (WORLD_INVALID). It refuses an input with no plugin or with two plugins, and a plugin with a master that the installed game does not have.

Run one session by hand

esx probe start --mod build/Data --label "my test"
esx probe call game.state --session s-20261004-012143-64f1
esx probe call item.give --args '{"form": "MyGun", "equip": true}' --session s-…
esx probe call camera.set --args '{"view": "third"}' --session s-…
esx probe call screenshot.take --args '{"name": "third"}' --session s-…
esx probe call ammo.get --session s-…
esx probe stop --session s-…

start copies the mod into the test folder, starts the game and returns when the game is ready. Its result has the session ID. With a test world in the test folder, the game goes to the cell of the world. --cell ID selects another cell, --save FILE.fos starts from a save, and --main-menu stays in the main menu. With no test world, the game stays in the main menu unless you give --cell or --save. The game has the test cell QASmoke. call sends one request. esx probe ops lists the requests. stop quits the game and removes the mod from the test folder.

Only one game runs at a time. A second start fails with GAME_BUSY and shows the label of the owner. On native Windows with --display headless, --allow-other-games permits a Fallout 4 that runs from a different folder. One test folder still runs one game.

Make the plan from a project

esx probe plan writes the plan of a project that esx build built. The build knows what to test, so the plan needs no hand edit.

esx build
esx probe plan                      # writes build/test-plan.toml
esx probe run build/test-plan.toml -o build/test-report

The plan is for the files in build/release/. It has these steps:

  • For each new weapon record: give and equip it (equipped, weapon_loaded), fill the magazine, draw it (drawn, ready), and check its name and its magazine size.
  • For a weapon with a behavior source: check its animation keyword, and check that the first-person graph files of the player have each graph of the weapon.
  • For each when ammo == N play CLIP rule of the reload action: set the loaded count to N, reload, wait for the start and the end of CLIP, and check that the magazine is full and that the total did not change. One more case uses a count that no rule names, and waits for the vanilla clip WPNReload.
  • For each weapon: three pictures of the weapon with its default parts, from the yaws 45, 90 and 135.
  • For each part of the weapon that is not a default part: one part case.
  • For each new armor record: give and equip it (worn, model_loaded), and take four pictures. The camera target is head when each biped slot of the armor is on the head (slots 30 to 32 and 46 to 50). If not, the target is body.

The plan has no group, so its steps run in the order of the file. It has no ActionDraw step, no settle step and no console equipitem: probe DLL 0.2.0 makes them unnecessary.

Part cases

A part of a weapon is an OMOD record of the plugin that is not a mod collection, with one MNAM keyword that is a keyword of the weapon. The default parts are the includes of the default combination of the weapon. Each other part gets one case:

[[step]]
id = "mts255gun-part-mts255reflex-remove"
do = "console.run"
args = { command = "removeitem ${weapon_mts255gun} 100", target = "player" }

[[step]]
id = "mts255gun-part-mts255reflex-form"
do = "form.find"
args = { form = "MTS255Reflex" }
expect = { type = "OMOD" }
save = { part_mts255reflex = "form_id" }

[[step]]
id = "mts255gun-part-mts255reflex-give"
do = "item.give"
args = { form = "MTS255Gun", equip = true, mods = ["MTS255Reflex"] }
timeout_ms = 20000
expect = { equipped = true, weapon_loaded = true }

[[step]]
id = "mts255gun-part-mts255reflex-draw"
do = "weapon.draw"
args = { drawn = true }
timeout_ms = 20000
expect = { drawn = true, ready = true }

[[step]]
id = "mts255gun-part-mts255reflex-weapon"
do = "weapon.get"
expect = { mods = { contains = { form_id = "${part_mts255reflex}", name = "MTS reflex sight" } }, keywords = { contains = "dn_HasScope_ReflexSight" } }

[[step]]
id = "mts255gun-part-mts255reflex-pictures"
do = "screenshot.orbit"
args = { name = "mts255gun-mts255reflex", target = "weapon", yaws = [45, 90, 135] }
timeout_ms = 60000
expect = { count = 3 }
  • The console removes the weapon first. item.give with mods fails with ENGINE_ERROR when the player already has the weapon. The new weapon has its default parts and the part of the case, so one case does not change the next.
  • The keywords check has one keyword for each Keywords property with ADD of the part. A second keyword gets a weapon.get step of its own. A part with no such property has only the mods check.
  • The name of a keyword of a master needs the masters. Give --data with the Data folder of the game: esx --data DIR probe plan. Without the masters, the plan has no check of these keywords, and not_covered says so.
  • --max-part-cases N is the largest number of part cases in the plan. The default is 24. not_covered lists the parts that the limit leaves out.
  • parts of each weapon in the result lists each part with its attach point, default and case.

The pictures are from the right side of the player. The player holds a drawn gun down along the right leg, so a picture from the yaw 270 shows the leg only. After a part case gives the weapon, the player can aim the gun for some seconds, and the pictures then show that pose.

What the plan does not test

not_covered in the result lists what the plan does not test:

  • A variant of fire, bolt, melee, equip, unequip or throw. No plan that passed in the game has a step pattern for these actions.
  • A reload condition that is not ammo == N, and a variant for power armor views only.
  • The workbench menu, crafting, and the loose mod that a removed part returns. The probe cannot read the workbench menu. A part case attaches the part with the Papyrus function AttachModToInventoryItem, so it can pass for a part that the workbench does not offer.
  • NPC use, held input, sound, and the look of a model. A person must judge the pictures.

The command fails with PLAN_STALE when a behavior source changed after the build of the release, and with RELEASE_MISSING when the project has no release. --dry-run prints the plan and writes no file. --cell ID selects the test cell. The default is the cell of the test world in the test folder (cell_source of the result is world), and QASmoke if the test folder has no world.

The plan for BountyKit (two weapons with default parts only, one hat) has 49 steps and passed in the game in 63 seconds of step time. The same project with three more parts for one weapon has 69 steps and passed in 81 seconds of step time.

To change the plan, copy it out of build/ and correct the paths of mod: they are relative to the folder of the plan.

Write a test plan

A plan is a TOML file. esx probe run checks the file, starts a session, runs each step, stops the session and prints one report.

plan = 1
name = "counted reload"

[profile]
mod = ["../build/Data"]
cell = "WeapTest"

[[step]]
id = "give-weapon"
setup = true
do = "item.give"
args = { form = "MyGun", equip = true, mods = ["MyGunLongBarrel"] }
expect = { equipped = true }

[[step]]
id = "give-ammo"
setup = true
do = "ammo.set"
args = { loaded = 6, reserve = 200 }

[[step]]
id = "draw"
setup = true
do = "weapon.draw"
args = { drawn = true }
expect = { drawn = true }

[[step]]
id = "mod-graph"
setup = true
do = "anim.state"
expect = { "graphs.player_1st.behavior_files" = { contains = "MyGunBehavior.hkb" } }

[[group]]
id = "reloads"
for_each = [
  { loaded = 5, clip = "WPNReload1" },
  { loaded = 0, clip = "WPNReload" },
]

  [[group.step]]
  id = "set-count"
  do = "ammo.set"
  args = { loaded = "${loaded}" }
  save = { total_before = "total" }

  [[group.step]]
  id = "reload"
  do = "action.run"
  args = { action = "ActionReload" }
  timeout_ms = 12000
  wait = [{ clip_start = "${clip}", owner = "player_1st" }, { event = "reloadComplete" }]

  [[group.step]]
  id = "magazine-full"
  do = "ammo.get"
  expect = { loaded = 6, total = "${total_before}" }
esx probe run tests/reload.toml --check          # check the file only
esx probe run tests/reload.toml -o build/test-report

cell is the cell where the plan starts. WeapTest is the cell of the test world of this guide. With no cell, no save and no main_menu = true, the plan starts in the cell of the installed test world, and in the main menu if the test folder has no world.

The steps and the groups run in the order of the file. A group runs one time for each for_each entry. A step that is after a group in the file runs after the last case of that group. esx probe run PLAN --check shows the order in the field order.

Key of a step Meaning
do, args The request and its arguments.
expect Checks on the response. A literal checks equality. A table uses one of eq, ne, lt, le, gt, ge, contains, matches, one_of.
wait Conditions that must occur after the request: event, clip_start, clip_end or graph_active, with an optional owner.
save Stores a response value in a variable. Use it later as "${name}".
setup A failure of this step stops the plan with result error.
screenshot true takes a screenshot after the step. It waits until the model of the player is loaded and visible, for at most 5 seconds. The report folder gets the PNG file.
timeout_ms The time limit of the step with its waits.

A wait on clip_start proves which clip played. A refill of the magazine does not prove it: the vanilla reload refills too. A check of behavior_files in anim.state proves that the weapon uses the graph of your mod.

A screenshot waits until the model of the player is loaded and visible. Its result has model_ready, waited_ms and model_wait (ready, timeout, off or unsupported). After timeout, the screenshot is taken and model_pending names the biped slots without a model. The argument wait_ms of screenshot.take changes the limit of 5000; 0 stops the wait.

Ops

Subject Ops
Game game.state, game.coc, game.load, game.save, game.quit, env.check
Console and message boxes console.run, ui.message.get, ui.message.answer
Items form.find, item.give, weapon.get, weapon.draw, weapon.nodes, ammo.get, ammo.set
Actions action.run, anim.send_event
Animation anim.wait, anim.trace, anim.clips, anim.state, anim.vars.set
View camera.get, camera.set, camera.orbit, player.model, screenshot.take, screenshot.orbit
Logs papyrus.log

esx probe ops lists each op with its arguments.

Take pictures of an item

The camera of camera.set stays behind the shoulder of the player. camera.orbit puts a free camera around the third-person model.

Argument Meaning
target body (default), head or weapon. The camera looks at this point.
yaw The direction from the target to the camera, in degrees. 0 is in front of the player, 90 is at its right side, 180 is behind it.
pitch Degrees above the target. From -89 to 89.
distance Game units. Default: 220 for body, 60 for head, and 3.5 times the radius of the model for weapon.
reset true goes back to the third-person view. camera.set does the same.

The result has what the camera does: camera_position, target_position, and the yaw, pitch, distance and side that the game has.

screenshot.orbit takes one picture for each yaw and then puts the camera back. It hides the HUD for the pictures.

[[step]]
id = "hat"
do = "item.give"
args = { form = "MyHat", equip = true }
expect = { worn = true, model_loaded = true }

[[step]]
id = "hat-pictures"
do = "screenshot.orbit"
args = { name = "hat", target = "head", yaws = [0, 90, 180, 270], pitch = 10 }
timeout_ms = 60000
expect = { count = 4 }

The report folder gets hat-yaw000.png, hat-yaw090.png, hat-yaw180.png and hat-yaw270.png. The response has, for each picture, its path, the camera data and model_ready.

screenshot.take with hud = false hides the HUD for one picture. With the HUD, a picture in the 5 seconds after an earlier one shows the screenshot message of the game.

Read the result

Result Exit code Meaning
pass 0 Each check and each wait passed.
fail 7 A check or a wait failed. error.details has the complete report.
error 5 A setup step failed, or the game ended (GAME_CRASHED) or stopped (GAME_HUNG).

A wait that fails lists what it saw instead:

{"clip_start": "WPNReload4", "owner": "player_1st", "ok": false, "error": "TIMEOUT",
 "seen": {"clips": ["WPNReload3", "WPNRunForwardReady"], "events": ["reloadStateEnter", "ReloadComplete"]}}

The report folder has report.json, events.ndjson with each animation event and clip of the run, the probe log, the F4SE log and the Papyrus log. The report has the SHA-256 of each mod file, so you can prove which build the test used.

Facts about the game

  • Draw the weapon before a reload. ActionReload is refused while the weapon is holstered.
  • weapon.draw waits for the model and the animation subgraph of the weapon, draws it, and returns when the weapon is ready (ready = true). This is also correct after an equip of a second weapon. A plan needs no settle step.
  • item.give with equip = true waits for the same load of a weapon and reports it as weapon_loaded.
  • item.give with mods attaches the parts only to a weapon that the player gets new. When the player already has the weapon, it fails with ENGINE_ERROR. Remove the weapon first: console.run with removeitem FORMID 100 and target = "player".
  • In third person the player holds a drawn gun down along the right leg. For pictures of a weapon, use the yaws 45, 90 and 135. From the yaw 270 the leg hides the gun.
  • For armor and clothing, item.give with equip = true reports worn, model_loaded and biped_slots, with the slot number of the Creation Kit (30 for the hair top slot).
  • An editor ID of your mod works as a form: esx reads it from the plugin. For a record of the base game, use Fallout4.esm:LOCALID.
  • The owner of a first-person clip is player_1st. Third person is player_3rd.
  • action.run with ActionFireSingle fires one shot. Wait for the event WeaponFire, and do not wait for the fire clip by its name: for a shot from the hip the first-person graph of the .44 selects WPNFireSingleReady, WPNFireSingleReadyA or WPNFireSingleReadyB at random. A step env.check with args = { frames = 180 } took 3.4 to 4.5 seconds in the test runs, which is sufficient for the clip. A shot of the last round starts a reload.
  • The graph of a weapon model gets each event of the player. To test such a graph, send the event to player with anim.send_event, and read the result with weapon.nodes.
  • With a mod active, the game asks a question before each load of a save. game.load answers it.
  • The item count of the ammunition includes the loaded rounds.

Facts about the test world

These facts are from three game runs on 6 October 2026 with TestWorldspace.esp (runtime 1.11.240, probe 0.2.0). The plugin has the world TestWorld, and WeapTest is a cell of it.

  • The game is ready in WeapTest 16 seconds after the start. env.check reports no problem, at 60 frames in a second.
  • The ground is flat to the horizon: dark grey with a grid of white lines. The background is one plain color with no cloud, no sun and no object at the horizon.
  • The player stands at X 2492, Y 2097, Z -2048 and looks north. A weapon workbench is some steps in front of the player, to the left. It shows in a picture from the yaws 135 and 180, and not from the yaws 0, 45, 90 and 270.
  • The time of the game is 11:00. The light comes from behind the player, and the shadow of the player is sharp and falls to the front. The right side of the player has even light, so the yaws 45, 90 and 135 are correct for pictures of a weapon. From the yaw 0 the face is in the shade.
  • A plan with item.give of the 10mm pistol (Fallout4.esm:004822), weapon.draw and screenshot.orbit passed 12 of 12 steps. The plan that esx probe plan wrote for the example fo4-armor-band passed 3 of 3 steps.
  • The plugin has four weathers that change only the color of the background: BackgroundBrown (local ID 0052A1), BackgroundGrey (0018DB), BackgroundBlue (004A2A) and BackgroundGreen (004A2B). The background at the start is the blue one.
  • The game keeps no EditorID for a weather, so fw BackgroundGreen fails. Find the form first, then force the weather. The change shows in the next picture:
[[step]]
id = "green-form"
do = "form.find"
args = { form = "TestWorldspace.esp:004A2B" }
save = { green = "form_id" }

[[step]]
id = "green-weather"
do = "console.run"
args = { command = "fw ${green}" }

esx help-topic game-test has the complete reference: each key of the plan, each error reason and the safety rules.

Limits

  • The probe cannot judge the look of the game. A screenshot gives the image; a wrong pose, a clipped hand and a missing texture still need a person to look at it.
  • The probe gives the animation name of a clip as the graph has it, not the file that the engine loaded. The local time of a clip and the states of a state machine are not available.
  • Held input, for example a sprint reload, is not done.

See the runs in the interface

The game test view of esx-gui shows the runs of a project: each step with its result and its message, and each picture. Give each run its own report folder in the output folder of the build, so that the view lists it:

esx probe run build/test-plan.toml -o build/test-runs/001

The view lists a folder with report.json in build/, and one level below. A run with no -o has its report in the session folder, and the view does not list it. For a step of a part case, the view shows the local picture of esx render weapon with the same part beside the picture of the game. The interface starts the game only from “Run in the game” and its dialog, which names the plan. The page has the state of the game test tools, the build and the test plan as one line each, and “Make the test plan”.