Running from the command line¶
Every workspace has a small program in local/xpress.py. XPressRT writes it
there each time it opens the workspace. With it, a pipeline, a script at the
line or you in a terminal start the same run as Run test does — with the
same record and the same report:
python3 local/xpress.py run --procedure "Incoming/Visual" --junit results.xml
Run it in the workspace folder (or name the folder with --workspace). It
needs Python 3.11 or later and nothing else.
Copy CI command¶
You need not type the call. In the ⋯ menu of a procedure or a test case (in the editor) and of a suite:
-
Copy CI command — for a pipeline:
--headless, the JUnit file underresults/(a run writes there anyway, so a clean checkout stays clean apart from it):python3 local/xpress.py run --headless --procedure Incoming/Visual --junit results/xpress-junit.xml
-
Copy line PC command — for a shortcut at the line:
--window.
A plan has neither, because it does not run as a whole. Add what only the
pipeline or the line PC knows:
--bench, --answers, --operator, --close-after, --safe-state-before-run.
What to run¶
| Option | Runs |
|---|---|
--test-case "Incoming/Visual" "Voltage" |
one test case of a procedure |
--procedure "Incoming/Visual" |
every test case of the procedure |
--suite "Nightly" |
every test case of the suite |
--plan "Release 2.5" |
nothing yet: a plan does not run as a whole (see below) |
--bench HIL-02 runs it on that bench, as the bench pill in the run view does.
--plan does not start a run yet. With --headless, and with no window open,
it is refused with the reason. With a window it ends with exit code 2 and
Not started and the sentence "Running a plan as a whole is not possible yet."
(Running a test). Name its suites or test cases instead.
Three ways to run¶
XPressRT is open with the workspace. The run goes in that window, visibly;
the terminal follows it step by step. xpress looks for the window for five
seconds (--wait changes that).
--headless — for CI. No window: xpress starts Chrome, Chromium or Edge
invisibly, with a new profile of its own, and loads XPressRT from --app, the
environment variable XPRESS_APP, or the address the last window noted in
.xpress/app.json. The page gets the workspace from xpress itself: nothing is
copied, and what the run writes is in the folder at once — only results/.
Without a flag and without a window, a run goes this way too.
In a checkout, local/xpress.py has to fit the version of XPressRT the run loads.
Open the workspace in that version once and commit the file it writes. An old
local/xpress.py otherwise says no more than Unrecognized arguments: --headless.
--window — at a line PC. A window of its own that shows only the run: the
steps, the questions to the operator and Stop the run — no navigation, no
editor. Who runs the test comes from --operator "A. Weber" (or operator in
the answers file); without it the window asks before the run starts, and the
name goes into the report. At the end the result stands big in the window —
Passed green, Failed red with its reason, Incomplete amber — until the
operator presses Close. --close-after 10 closes it ten seconds after a
passed run; after any other result it waits for the operator. Closing the
window before the end stops the run. A shortcut on the desktop of the line PC
is all it takes:
python3 local/xpress.py run --window --procedure "EOL/Final" --bench LINE-3 --close-after 10
The browser for --headless and --window is found where Chrome, Chromium or
Edge usually are; --browser or XPRESS_BROWSER names another. XPressRT from
another computer has to come over https; http only from localhost.
What a person would be asked¶
Before the start the terminal says everything the run will ask a person — a question, a value to type, a request to carry out, a serial number — and where. An answers file answers it:
python3 local/xpress.py run --headless --suite Nightly --answers answers.json
{
"questions": ["yes", "no"],
"points": { "Unit/Voltage": 12.1 },
"requests": { "Unit/Flash": "done" },
"serial_numbers": ["SN-001"],
"operator": "A. Weber"
}
Lists are used in order. What the file answers, the run takes from it, and its record names the file and its SHA-256 at every such answer. A run that took an answer from a file does not count towards test plans — nobody looked.
- In a window the rest is asked there, as usual.
- With
--headlessnobody can answer: a run that would ask something the file does not answer (or answers with something that does not fit) does not start, and says what is missing. A test plan does not run with--headless.
The bench¶
A real bench needs its address and a pairing — the browser of --headless and
--window is new each time:
- Address:
--bench-address https://hil-02.example.com:8050orXPRESS_BENCH_ADDRESS, else what this computer noted in.xpress/benches.local.jsonwhen you added the bench. It must be the server of that bench. To another computer only overhttps: the bench's key would otherwise cross the network in clear text. - Pairing:
XPRESS_BENCH_KEYfrom a secret of the pipeline, or--code— xpress then asks for the six digits the bench server shows, without showing them. The code never goes on the command line. --safe-state-before-run: every driver of the bench that is switched on and has a safe state goes into it before the first test case, as the box Safe state before run does. If one fails, the run does not start. Without a bench it does nothing, and the report says No bench.
The result¶
--junit results.xml writes the run's JUnit report — all procedures in one
file, only the test cases that were asked for. Where there is no result, the
file says why, so a pipeline never reads the last run's file as this one's.
| Exit code | Means |
|---|---|
| 0 | passed: no test case is red |
| 1 | a test case is red (failed, or needs investigation) — also when the run is incomplete besides |
| 2 | nothing ran: no window, a wrong call, the run could not start, or a run with no test case |
| 3 | incomplete, without a red test case: stopped, aborted by the bench, a test case did not run — also when the only test case has no step —, the recording stopped at the disk limit, or a driver did not take the safe state at the end |
The words are in One result per test case.
In the JUnit file a test case with no step is skipped, with not run in its
message, so a pipeline does not count it as passed.
Ctrl+C — and SIGTERM, which is how a pipeline cancels a job — stops the run as Stop the run does and waits for its end; a second Ctrl+C leaves at once. One xpress at a time per workspace: a second one is refused until the first has ended.
Not yet¶
--headlessand--windowdo not run on Windows yet: there the browser could only get its way to xpress on its command line, which every program on the computer can read.