Skip to content

File formats ​

The server, the CLI, the SDK and the test runner read and write these files. Each is JSON or text you can read, diff and edit.

FileWritten byWhere
<name>.saptest.jsonsap_record, SAP_RECORD=on; the SDK and the runner as a traceSAP_RECORD_DIR; traces in the runner's output directory
<name>.sap.lock.jsonthe runner, the SDK's verified mode, sap_workflow_runnext to the test; for a workflow, in .workflows/
// @sap-workflowyou, or sap_workflow_savethe first line of a *.sap.ts workflow
.workflows/*sap_workflow_save, sap_workflow_run, the runnernext to the workflow, in SAP_RECORD_DIR for MCP
exportsexport, sap_record {"op":"export"}next to the recording

Recordings, traces and evidence hold typed values and what the screens showed: treat them like the system's data.

Recordings (.saptest.json) ​

One JSON object per run, format id sap-gui-test/1. The recorder writes the whole file again after every change (through a .tmp file it then renames), so a crash loses nothing. Each load checks the file against the schema, and every action in it must be one sap_act accepts today. Fields the schema does not name are ignored.

Source: src/record/format.ts, src/record/recorder.ts, src/record/replay.ts.

A recording made on SAP GUI for Windows: display a sales order in VA03 and check its sold-to party (system and numbers are samples).

json
{
  "format": "sap-gui-test/1",
  "name": "display order",
  "description": "Display a sales order and check its sold-to party",
  "recorded": { "at": "2026-11-30T09:00:00.000Z", "by": "sap-ui-automation 0.6.0 (cli)", "surface": "sapgui", "system": "DEV", "client": "100" },
  "start": { "transaction": "SMEN", "program": "SAPLSMTR_NAVIGATION", "screen": "101", "title": "SAP Easy Access" },
  "variables": { "order": { "value": "12345", "description": "a sales order that exists" }, "soldTo": { "value": "100001" } },
  "steps": [
    { "action": { "do": "okcode", "value": "/nVA03" }, "at": "2026-11-30T09:00:01.000Z", "ms": 414, "risk": "navigate",
      "on": { "transaction": "SMEN", "program": "SAPLSMTR_NAVIGATION", "screen": "101", "title": "SAP Easy Access" },
      "after": { "transaction": "VA03", "program": "SAPMV45A", "screen": "102", "title": "Display Sales Order: Initial Screen" } },
    { "action": { "do": "set", "id": "ctxtVBAK-VBELN", "value": "${order}" }, "at": "2026-11-30T09:00:02.000Z", "ms": 16,
      "target": { "id": "wnd[0]/usr/ctxtVBAK-VBELN", "type": "field", "label": "Order", "handle": "ctxtVBAK-VBELN" },
      "risk": "navigate",
      "on": { "transaction": "VA03", "program": "SAPMV45A", "screen": "102", "title": "Display Sales Order: Initial Screen" },
      "after": { "transaction": "VA03", "program": "SAPMV45A", "screen": "102", "title": "Display Sales Order: Initial Screen" } },
    { "action": { "do": "key", "key": 0 }, "at": "2026-11-30T09:00:03.000Z", "ms": 434, "risk": "navigate",
      "on": { "transaction": "VA03", "program": "SAPMV45A", "screen": "102", "title": "Display Sales Order: Initial Screen" },
      "after": { "transaction": "VA03", "program": "SAPMV45A", "screen": "4001", "title": "Display Standard Order ${order}: Overview" },
      "expect": [ { "check": "field", "op": "equals", "value": "${soldTo}",
                    "id": "wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/subPART-SUB:SAPMV45A:4701/ctxtKUAGV-KUNNR",
                    "type": "field", "label": "Sold-To Party", "handle": "ctxtKUAGV-KUNNR" } ],
      "note": "the overview shows the order's sold-to party" }
  ]
}

Top level ​

FieldTypeRequiredMeaning
format"sap-gui-test/1"yesthe format id; any other value is refused
namestring, at least one characteryesthe test's name; the file name is its slug (display-order.saptest.json)
descriptionstringnowhat the test is for, from sap_record {"op":"start","description":...}
recordedobjectyeswhere and when it was recorded (below)
startscreen referenceyesthe screen the recording started on (below). When the first step is not an okcode /n<transaction>, replay opens /n<start.transaction> first (not SMEN, S000, SESSION_MANAGER, nor on Fiori) and, in strict mode, stops if program and screen differ
variablesobject: name → variableyes, may be {}values that change from run to run (below)
stepsarray of stepsyes, may be []the actions in order (below); replay refuses a test without steps

recorded ​

FieldTypeRequiredMeaning
atstring, ISO timeyeswhen the recording started
bystringnowhat wrote it: sap-ui-automation <version>, ... (cli) from the agent CLI, sap-ui-automation sdk <version> from the SDK and runner. No user name
surfacestringyessapgui, webgui or fiori. Replay refuses a session of another surface
methodstringnohow the surface was read when it is not the usual way: diag for the network reader. Absent for SAP GUI scripting and the other surfaces. On SAP GUI, replay refuses a session read another way, and vbs refuses a diag recording
systemstringnothe system id
clientstringnothe client

Screen references ​

start, a step's on and a step's after share these fields. A field is absent when the screen did not show it.

FieldTypeRequiredMeaning
transactionstringnothe transaction code
programstringnothe program (SAPMV45A)
screenstringnothe screen number (4001)
titlestringnothe window title; may hold ${variables}

Variables ​

Each key of variables is a name: letters, digits and _, not starting with a digit. A step writes ${name} where the value stood alone (not inside a longer word or number).

FieldTypeRequiredMeaning
valuestringyesthe value in the recording, and the default at replay
descriptionstringnowhat the value is; a capture writes read from the field Customer after step 3

Replay fills ${name} in an action's value, key and node, in check values, and in the status texts and titles it compares; a name with no value is an error. replay --var name=value gives another value; an unknown name is refused.

Steps ​

FieldTypeRequiredMeaning
actionobjectnothe action as sap_act takes it, do first. Absent for a step that only checks
targetobjectnothe control the action was done on (below)
riskstringnoread, navigate or commit, as the surface rated the action when recorded. Informational: a replay assesses every step again on the live screen, and the guard ignores this label
notestringnowhat the step is for (sap_record {"op":"note"}); replay's output and most exports show it. The author's text, as are the labels: not checked against SAP
groupstringnothe sap.step(name, ...) block the action ran in, from SDK code; nested blocks joined with ›
onobjectnothe screen the action was done on: a screen reference plus popup and message (below)
afterobjectnothe screen and status bar the action led to: a screen reference plus status (below)
expectarray of checksnowhat must hold on the screen the step led to (below)
capturearray of capturesnovalues read from that screen into variables, before the checks run (below)
msnumber, 0 or morenohow long the action took, from sending it to SAP's answer, in ms; written on every step recorded from an action. Replay reports a step much slower than this
atstring, ISO timenowhen the step started; written with ms
screenstringnotrace only: the compact screen the action led to, as an agent reads it
shotstringnotrace only: a screenshot of that screen, a path relative to the file
codestringnotrace only: the SDK line that repeats the action

target ​

FieldTypeRequiredMeaning
idstringyesthe control's full SAP id when recorded (wnd[0]/usr/ctxtVBAK-VBELN). When the screen moved it, replay finds it by its last segment or field name, and says so
typestringnoits type (field, button, checkbox, tab...)
labelstringnoits label
handlestringnothe shortest tail of the id that named this control alone on that screen. Never for a numbered control (btn[0]). Tidy uses it for short ids

on and after ​

FieldTypeRequiredMeaning
on.popupstringnothe popup window in front when the action was done (wnd[1])
on.messagebooleannotrue when that popup only informed (text and Continue, no question, no input): a replay may skip the step when SAP does not show it
after.statusobjectnothe status bar the action led to
after.status.typestringnoSAP's message type: S, I, W, E or A
after.status.textstringyes, in statusthe message text; may hold ${variables}

After each step, replay fails it when the status bar shows E or A, unless after.status has the same type and text, and when transaction, program or screen differ from after where both have them (a note with --loose or "screens":"loose").

expect[] entries ​

FieldTypeRequiredMeaning
checkstatus, field, title, transaction, textyeswhat is checked: the status bar text, a control's value, the top window's title, the transaction code, or the whole screen
opequals, contains, matchesyesequals compares trimmed texts; matches takes a regular expression
valuestringyeswhat is expected; may hold ${variables}
idstringnofor field: the control's full SAP id when recorded
labelstringnofor field: the control's label
typestringnofor field: the control's type; exports read a checkbox or radio as ticked or not
handlestringnofor field: the shortest unique id, as in target.handle

capture[] entries ​

FieldTypeRequiredMeaning
varstring, a variable nameyesthe variable the value goes into
fromstatus, field, titleyeswhere the value is read
idstringnofor field: the control's full SAP id
labelstringnofor field: the control's label
patternstringnoa regular expression: its first group is the value, else the whole match. Without it, the whole text, trimmed. No match or an empty value fails the step
handlestringnofor field: the shortest unique id, as in target.handle

Traces ​

A trace is a recording the SDK or the test runner writes: recorded.by is sap-ui-automation sdk <version>, steps have group from sap.step blocks, screen and code, and shot with screenshots on (the runner's use: { screenshots: true }, or screenshots: true in connect's trace; the PNGs are in <name>.trace/ next to the file). Replay runs a trace like a recording; show-trace makes an HTML page of either (Trace viewer).

RunTrace file
connect({ trace: { dir, name } })<dir>/<slug of name>.saptest.json
the test runner<outputDir>/<test>/<slug of the title>.saptest.json; outputDir is sap-results by default; a retry writes to <test>-retry<n>/
sap_workflow_runthe same, under sap-results/ in SAP_RECORD_DIR

What a trace adds to the third step of the example (screen shortened):

json
{
  "group": "Display the order",
  "code": "await sap.key(0);",
  "screen": "TRANSACTION VA03  PROGRAM SAPMV45A  SCREEN 4001\nWINDOW wnd[0]  \"Display Standard Order 12345: Overview\"\nctxtKUAGV-KUNNR  field  Sold-To Party = \"100001\"  (read-only)",
  "shot": "display-order.trace/step-3.png"
}

Lock files (.sap.lock.json) ​

A lock holds what SAP answered on passing runs of a *.sap.ts test: per test and sap.step block, the actions with the screen and status bar each led to. Verified mode compares each action's landing with it, with no model (Lock files). Format id sap-gui-lock/1.

Source: src/sdk/lock.ts, src/sdk/verify.ts.

Test fileLock file
orders.sap.ts (no @sap-workflow header)orders.sap.lock.json next to it; any other x.ts → x.lock.json
a workflow with a @sap-workflow header, run by the runner.workflows/<name>-<revision>.sap.lock.json in the test's folder
a workflow run by sap_workflow_runSAP_RECORD_DIR/.workflows/<name>-<revision>.sap.lock.json
connect({ verify: { lock } })the path given

A workflow's lock belongs to one revision of its source (below): editing the file starts a new lock. The example shows one action; the /nVA03 and Enter around it are left out.

json
{
  "format": "sap-gui-lock/1",
  "tests": {
    "display order": {
      "verified": { "at": "2026-11-30T09:00:00.000Z", "system": "DEV", "client": "100", "surface": "sapgui", "runs": 3, "lastPass": "2026-11-30T11:00:00.000Z" },
      "steps": [
        { "step": "Open the order", "ordinal": 1,
          "paths": [[
            { "action": { "do": "set", "id": "ctxtVBAK-VBELN", "value": "12345" },
              "target": { "id": "wnd[0]/usr/ctxtVBAK-VBELN", "handle": "ctxtVBAK-VBELN", "type": "field", "label": "Order" },
              "risk": "navigate",
              "on": { "transaction": "VA03", "program": "SAPMV45A", "screen": "102", "title": "Display Sales Order: Initial Screen" },
              "after": { "transaction": "VA03", "program": "SAPMV45A", "screen": "102", "title": "Display Sales Order: Initial Screen" } }
          ]] }
      ]
    }
  }
}

Lock ​

FieldTypeRequiredMeaning
format"sap-gui-lock/1"yesthe format id
testsobject: key → test entryyesone entry per test. The runner's key is the test's title path joined with ›, [<project>] before it in a project; connect uses default unless verify.key says otherwise

Test entry ​

FieldTypeRequiredMeaning
verifiedobjectyeswhere and when the entry was verified (below)
stepsarray of step entriesyesone per sap.step block run

verified ​

FieldTypeRequiredMeaning
atstring, ISO timeyeswhen the entry was first written
systemstringnothe system of the last write. Another system: not compared
clientstringnothe client of the last write
surfacestringyesthe surface. Another surface: not compared
runsinteger, 0 or moreyespassing runs counted when the entry was last written
lastPassstring, ISO timeyesthe time of that run

Step entry ​

FieldTypeRequiredMeaning
stepstringyesthe sap.step name, nested blocks joined with ›; "" for actions outside any block
ordinalinteger, 1 or moreyes1 the first time a block of this name runs in the test, 2 the second...
pathsarray of arrays of actionsyesone list of actions per way through the block that passed (a block with an if has one per branch taken)
repairsarray of repairsnorepairs that worked, applied by later runs where the same drift shows again

Action entry ​

FieldTypeRequiredMeaning
actionobjectyesthe action as the code ran it, values as typed in that run
targetobjectnothe control: id (required), handle, type, label, as in a recording's target. Not compared
riskstringnoread, navigate or commit, as the surface rated it. The repair rules read it
onscreen referencenothe screen it was done on, when it was read. Not compared
afterscreen referenceyesthe screen and status bar it led to

Action entry on and after ​

FieldTypeRequiredMeaning
transaction, program, screen, titlestringnoas in a recording's screen references
popupstringnothe popup window in front (wnd[1])
statusobjectnoafter only: type (optional) and text (required). Only the type is compared

Repair ​

FieldTypeRequiredMeaning
indexinteger, 0 or moreyesthe action of the block it is for, from 0
onstringyesthat action's identity, such as key:0 or set:ctxtVBAK-VBELN
placebefore, instead, afteryeswhere the repair's actions run
actionsarray of actions, at least oneyeswhat the repair does
whystringyesthe reason, as the fallback gave it
atstring, ISO timeyeswhen it was saved

What a verified run compares, and what a passing run adds ​

Each action is matched to the lock by its block (step, ordinal), its place in the block and its identity: the verb, the control id, the okcode command (upper case), the app of open, the key number, a dropdown key, row, col, node and how, never a typed value. The screen it led to must have the transaction, program and screen of after where both have them, a popup or none as after.popup says, and no new E or A in the status bar. The title and the status text are not compared.

A difference is settled at the code's next action or read: a branch when the code asks about the screen (sap.at, sap.popup, exists(), dismissInfo, the warning check of save), else drift (a saved repair, then the fallback, else Drift is thrown). An action the lock has nothing for is unverified, not a failure.

At the end of a passing run (sap.lock.finish(true), which the runner calls), each block run adds its actions as a path unless the same path is there (same identities, landings and errors), and repairs that worked join repairs. verified takes this session's system, client and surface, runs plus one and lastPass now. Paths are only added, and the file is written only when the entry changed apart from at, runs and lastPass, so a stable lock does not show in diffs. If another run changed the entry meanwhile, the write fails: run again. On another system or surface the default mode neither compares nor writes; write mode (--update-locks) replaces the entry.

Workflow header (@sap-workflow) ​

A workflow (Reusable workflows) is a *.sap.ts test whose first line is one JSON object after // @sap-workflow :

ts
// @sap-workflow {"description":"Display a sales order","inputs":{"order":"Sales order number"},"outputs":{"soldTo":"Sold-to party on the overview"},"verifies":"VA03 overview shows the order and its sold-to party"}
import { expect, test } from "sap-ui-automation/test";

Source: src/runner/workflow.ts, src/record/code-tools.ts.

FieldTypeRequiredMeaning
descriptionstring, not blankyeswhat the workflow does; sap_library searches it
inputsobject: name → descriptionyes, may be {}the values input(name) reads. Every input is a required string, not blank; a missing or unknown input is refused before the run
outputsobject: name → descriptionnothe string results output(name, value) returns. A passing sap_workflow_run needs each one, once
verifiesstring, not blankyesthe SAP result the workflow checks

Names are letters, digits and _, not starting with a digit. No other field is allowed, and the JSON stays on one line (a line break, U+2028 or U+2029 is refused). A literal input("x") or output("x", ...) must name a declared input or output; sap_workflow_save checks it. Its workflow argument writes the header for you, in place of a header line the code has. A *.sap.ts without the header runs as a plain test: its lock is next to it, and sap_workflow_run's variables override its const vars block.

The .workflows directory ​

The revision of a workflow is the SHA-256 of its whole source, header included. Locks, receipts and evidence belong to one revision, so an edited workflow is unverified until it passes again. They are in .workflows/ in the workflow's folder (SAP_RECORD_DIR/.workflows/ for MCP), named <name>-<revision>, <name> being the file name without .sap.ts (over 100 bytes: its SHA-256 and a dot). Through MCP the folder is readable by its owner only (0700), receipts and evidence too (0600).

FileWritten byHolds
<name>-<revision>.sap.lock.jsona passing runthe lock of this revision
<name>-<revision>.status.jsonevery sap_workflow_run that startedthe receipt: the latest attempt and the last pass (below)
<name>-<revision>-<digest>.actions.jsonsap_workflow_save with sourcethe reviewed sap_history actions the workflow was made from (below)
<name>-<revision>.passednot written by this versionread by sap_library as the last pass when the receipt has none

Two more folders in SAP_RECORD_DIR: .sap-code-runs/ holds the copy sap_workflow_run runs (imports pointed at this installation) while it runs, and sap-results/ holds its traces.

Receipt ​

FieldTypeRequiredMeaning
latestobjectyesthe latest attempt
latest.atstring, ISO timeyeswhen it ended
latest.surfacesapgui, webgui, fioriyesthe session's surface
latest.writeon, off, confirmyesSAP_WRITE then; confirm only in receipts saved before that mode was removed
latest.statuspassed, failed, drift, incomplete, timeoutyesthe outcome. incomplete: nothing failed, but the run did not verify the workflow (no test used a lock, a lock was not written, or not every test passed)
lastPassobjectnoat, surface and write of the last attempt that passed; kept when a later attempt fails

Receipts hold no screens, inputs, outputs or errors; sap_library shows them.

Evidence ​

FieldTypeRequiredMeaning
sessionstringyesthe session id the actions ran on
actionsarray of actionsyesthe selected actions that did not end in a dispatch error
entriesarrayyeseach selected history entry: action, and outcome, one of {screen, status?}, {error} or {note}; screen has transaction, program, number, title, popup
digeststring, 64 hex digitsyesthe SHA-256 of the session id and the entries; also in the file name. sap_workflow_save refuses a source whose digest no longer matches

Evidence keeps typed values as they were typed.

Exports ​

sap-ui-automation export <file> --to <target> [--out <file>] writes next to the recording (--out - prints), sap_record {"op":"export","name":"...","to":"<target>"} in SAP_RECORD_DIR. Each target turns the recording into one text file. When that file is there already (an earlier export, perhaps edited, or a saved workflow), the export fails and keeps it: --force or "replace": true writes over it. Usage: Recording and replay. The VBS and Playwright files are programs that run outside the guard and outside SAP_WRITE; sap-ts code goes through the guard.

Source: src/record/export/.

TargetFileForCannot express
calm.calm.jsonan SAP Cloud ALM manual test case, as the input of a Cloud ALM MCP server's calm_create_test_case toolnothing runs: actions, checks and captures are words for a tester. Over 30 activities (screens plus Preparation) is refused; titles and texts are cut at Cloud ALM's limits
vbs.vbsSAP GUI scripting (VBScript), for SAP GUI for Windowsa Fiori or diag recording is refused. Keys without a virtual key number, steps with a short id only, click, scroll, open, text checks and field checks without a full id become ' TODO lines. It answers no popup the recording does not have
playwright.spec.tsa Playwright test for Web GUI (@playwright/test)click, combo, tree, grid, toolbar, scroll, open, menu entries, keys with no browser key and short ids become test.fixme. Fiori output takes set, press, click, select and named keys only, has no field, status or transaction checks, and has not been run against a launchpad
playwright-sap.psap.spec.tsthe same with playwright-sap's locateSIDas playwright
sap-ts.sap.tsa test for this package's runner, written with its scripting APIthe checks replay makes after every step (no error, the recorded screen); a lock adds them when the test runs. Popups and screens SAP shows for some data only, beyond a recorded information popup: tidied code (sap_record {"op":"code","tidy":true}, an answer, not a file) writes them as conditions
gherkin.featurea Given / When / Then step list, for Cucumber-style tools and for readingno step definitions and no ids. Variables are one row of Examples with the recorded values; captures are a line to note a value

MIT licence. Independent open-source project, not affiliated with, endorsed by or sponsored by SAP SE. SAP and SAP Cloud ALM are trademarks of SAP SE.