Demo
GUIDE

Test Blocks

11 MIN READ

Test Blocks is one of the ways to create a test, alongside writing Gherkin from scratch, recording a browser session, generating with Magic Test, and importing an existing framework. It is available on the Web and Mobile tabs of Create New Test.

An official run uses the Test Blocks executor. The same test can sit in a Test Suite, appear on Test Runs, and show up in reports like any other test.

What it is

A Test Blocks test is an ordered list of steps. Each step is one action or one check, written in English, as Python, or both. The product turns English into Python, runs that Python against a real browser, a real device, or a backend call, and keeps a status on each step.

The Origin column on the Tests list shows how each test was created. Two origins are Test Blocks tests:

Origin label How the test was created
Test Blocks Create New Test → Test Blocks, or a Manual, Recorded, or Import Tests test converted to Test Blocks
Test Blocks with Magic Tests Magic Test generated straight into Test Blocks, or a Magic Test later converted

The other origins (Manual, Recorded, Magic Test, Import Tests) are Gherkin tests; any of them can be converted.

Convert to Test Blocks is available on any test that is not already Test Blocks (written from scratch, recorded, imported, or Magic Test). Hypermind Code Blocks and the SDET / AI Exploration automation switch are hidden on a Test Blocks test—the step’s own Python is the script.

Tests list filtered to Demo, showing Test Blocks and Magic Test origins on prod

Create a Test Blocks test

Location: Test Management → Tests → Create New Test

The popover has Web and Mobile tabs, each offering From recording, From scratch, Test Blocks, Magic Test, and Import framework. Choose Test Blocks on the tab that matches what you are testing.

Create New Test on the Web tab, including Test Blocks

Before you add steps, attach the same building blocks as for Gherkin tests—Environment, Test Data, Authentications, and Integrations as needed.

The step list and statuses

Numbered steps show a status and, on hover, Run until this step, Edit, Insert after, and a menu (View code, Duplicate, Copy, Cut, Delete). The right rail is Configuration, Variable Dictionary, and—on web tests—Browser. On mobile tests the live surface is the device stream; there is no Browser tab, no Open browser, and no web recording rail.

Status Meaning
Captured Recorded on the page; its code is not written yet
Inferred Code written from a recording or generation, not yet proven by a run
Needs run Not proven yet, or must run again because an earlier step was edited and it may now start somewhere else
Queued / Running A run is waiting or in progress
Verified Action and outcome proven, or a saved signature still matches
Failed The step stopped; a soft assertion shows Failed · soft
Skipped Will not run
Blocked Needs your help before it can continue; see Troubleshooting failed steps
Cancelled End session stopped the step mid-run

Test Blocks builder for the prod docs demo test (t655kavl9ugvc7o)

Recording in the builder (web only)

On web Test Blocks, open the Browser tab and Open browser to start a live remote Chrome session. While recording, actions become steps. End session writes captured steps into the test.

From Recording (Create New Test) still produces Gherkin. The browser inside a web Test Blocks test produces steps, not a Feature file.

Mobile Test Blocks does not offer browser open or record-from-browser. Author Device steps in English or Code, use Pre-seeded steps for common device actions, or type instructions and Run until this step to verify. See Mobile Test Blocks below.

Editing a step

Tabs are Natural language and Code. While you edit one, the other is view-only.

  • Needs browser to run (on mobile tests, Needs device to run) decides where the step runs. Turn it off for steps that only query Salesforce, call an API, or work with values; they run without a browser or device. See Browser, device, or no browser at all.
  • One action or one check per step. A plain-language step that bundles several is flagged Multiple intents detected with a suggested breakdown (assertions and recorded steps are never split). See One step, one intent.
  • Add as → Assert stops the test on failure; Soft assert records the failure, continues, and still fails the test.
  • Save stores without running; Save and run stores and executes through that step.
  • Saving a new plain-language description on a step that has code clears the code; the next run follows the description.

Natural language editor with Assert and Save and run

Run settings on the configuration rail sets Retries per failed step (default 5, range 0–20 on Live Test; at least 1 while authoring).

Retries per failed step

Logic, variables, and proof

After the first saved step, Add logic offers If and For each (nested If is allowed; nested For each is not).

Add logic and the new-step composer

The Variable Dictionary lists test data, environment, input, output, and temp tokens such as [$.testdata.dataset.key]. Use outputs (tz.setOutput) for values the next test in a suite must receive; temp stays inside one run.

Variable Dictionary

Show proof on a verified step opens the post-step screenshot, action log, and code that ran.

Proof for a verified step

Pre-seeded steps, backend, and mobile

Pre-seeded steps insert known Python instead of typing from scratch. The menu is filtered by test type: web tests see browser and backend recipes (Salesforce and general); mobile tests see device-only recipes—no Salesforce user switching, record CRUD, or page-compare recipes from the web catalog.

Pre-seeded steps menu (web Test Blocks; shows Salesforce browser recipes)

Web pre-seeded recipes (browser and backend)

Typical browser recipes include Switch user, Return to the original user, Log out, Change user profile, Create / Update / Delete / Look up a record, Compare the page to a reference image, Check a visual feature, Assert text on the page, Compare two values, and Run a security scan. Backend-surface recipes run without opening Chrome.

Mobile pre-seeded recipes (device only)

Recipe What it does
Launch app Brings an installed app to the foreground (tz.device.launch)
Close app Terminates an installed app (tz.device.close)
Press a device key Hardware key: enter, back, home, tab, search, or delete
Assert text on the screen Passes when text is present or absent on the current screen
Compare the screen to a reference image Screen capture vs an image attached to the test
Check a visual feature Model-assisted check for an icon, color, or layout on screen

Steps with Needs browser to run off use tz without a browser or device (for example tz.salesforce.soql or tz.api.get); proof labels them SOQL, Apex, API, or Advanced. A run that is only those steps does not lease a browser or a device.

For mobile, create the test on the Mobile tab with a mobile environment. Steps that touch the app have Needs device to run on. One run drives one surface: do not mix browser and device steps in the same run range. See Mobile Test Blocks and Mobile testing.

Mobile Test Blocks

Create the test from Create New Test → Mobile → Test Blocks. Attach a mobile Environment (device type, not Browser). The builder matches web Test Blocks for the step list, logic, variables, verify/save, and Live Test, but the execution surface is always a leased device, not remote Chrome.

Web builder Mobile builder
Browser tab, Open browser, record actions into steps No browser tab; no Open browser
Switch on a step: Needs browser to run Switch on a step: Needs device to run
Web pre-seeded + backend recipes Six device pre-seeded recipes only (table above)
Landing environment URL key required before verify (except connected Salesforce orgs) No landing URL key—app package and device session come from the mobile environment
Magic Test chevron: Gherkin vs Test Blocks Magic Test Generate Test Cases stays Gherkin only (no Test Blocks chevron on mobile)

Example flow: Launch app (pre-seeded or tz.device.launch), tap/type steps in English, Assert text on the screen, Run until this step until steps are verified, then Live Test. There is no browser stage to pop out; proof and device screenshots appear on verified steps like on web.

Convert to Test Blocks applies to Gherkin tests created on mobile the same way as web when the source is not Magic Test–only constraints; prefer creating Test Blocks directly on the Mobile tab for new mobile step tests.

Magic Test and conversion

On web, Magic Test → chevron on Generate Test Cases:

  • Gherkin — AI Exploration tests in Gherkin.
  • Test Blocks — unverified steps from the same prompt; open each test to verify.

The chevron is hidden for mobile Magic Test creation and when Test Blocks is off for the tenant.

Magic Test format menu

On any non–Test Blocks test, Convert to Test Blocks in the header (or More actions) splits the scenario into steps and opens the builder. If conversion fails, the test is unchanged and Retry convert is available.

Gherkin test with Convert to Test Blocks

Conversion keeps one scenario, maps Then (and following And/But) to assertion steps, and refuses Gherkin START LOOP / START IF blocks—rebuild those with Add logic after conversion. Scenario Outlines must be flattened to a single scenario first (same rule as on the Gherkin page).

Live Test and suites

When kept steps are verified and any open authoring session is ended (web: browser closed; mobile: device session settled), the stage offers Live Test. Official runs appear under Run Management → Test Runs.

To chain tests, add the Test Blocks test to a suite and map outputs into the next test’s inputs or test data. Suite scheduling for Test Blocks is still limited in some tenants—confirm in the UI before promising scheduled suite runs.

CLI, SDK, MCP, and skills

Use the product UI for loops, If/else, recording, locator pick, reorder, and convert-from-Gherkin. For linear create → verify → save → run flows, use the integrations below:

Surface Minimum version Entry point
CLI testzeus-cli 0.0.32 (depends on SDK ≥ 0.0.28); split review needs 0.0.35 testzeus test-blocks --help
Python SDK testzeus-sdk 0.0.28; split review needs 0.0.34 client.test_blocks
MCP server 2.0.4 create_test_blocks, add_test_blocks_step, verify_test_blocks, apply_test_blocks_split, save_test_blocks, live_run_test_blocks, …
Coding agent testzeus-test-blocks skill Routes away from Gherkin create_test

Do not create or copy Test Blocks tests with client.tests.create, testzeus tests create, create_test + test_feature, or records copy—steps live in the test-builder graph. Use test-blocks create / create_test_blocks instead. tests list and get_test expose executor and builder_status so agents can tell Test Blocks from Gherkin.

Lifecycle (web or mobile):

  1. Create — testing_type is web (default) or mobile.
  2. Config — environment, test data, knowledge bases; on web, set environment_url_key to the landing URL field on the environment (testzeus test-blocks config TEST_ID --environment-url-key KEY).
  3. Add step — --type browser|mobile|backend|soql|apex|http; mobile tests should use --type mobile for device steps. update-step / update_test_blocks_step edits a step; --assert-mode hard|soft makes it a check that stops the run or records the failure and continues.
  4. Split review — before verify runs anything, it checks that each plain-language browser step is one action, as Multiple intents detected does in the builder. A step that bundles several is held with suggested steps. Apply the split (test-blocks split TEST_ID STEP_ID --apply, apply_test_blocks_split, client.test_blocks.apply_split), reword the step, or keep it as one on purpose (--dismiss, dismiss_test_blocks_split, dismiss_split). Assertions, recorded steps, code you wrote, logic and backend steps are never held.
  5. Verify — optional --through STEP_ID; leases browser or device when the step range needs it. When a step fails, the test's authoring_progress.failure on that step gives a headline (what went wrong) and a recommendation (what to change). Reword or edit the step and verify again.
  6. Save — builder_status becomes ready only when every reachable step is verified.
  7. Run — test-blocks run / live_run_test_blocks (not generic run_test for live-run metadata), then test-blocks run-status RUN_ID / get_test_blocks_run_status. run_test refuses tests that are not ready.

Command and tool details: CLI · SDK · MCP Tools · Skills catalog.

Short path

Web

  1. Create New Test → Test Blocks; attach a web Environment and landing URL key.
  2. Record in the browser, write steps, or start from Magic Test / Convert to Test Blocks.
  3. Run until this step until steps you keep show verified.
  4. Live Test.
  5. Add to a Test Suite; use outputs for hand-offs.

Mobile

  1. Create New Test → Mobile → Test Blocks; attach a mobile Environment.
  2. Add Device steps (pre-seeded, English, or Code)—no browser recording.
  3. Run until this step until steps you keep show verified.
  4. Live Test (leases the device).
  5. Same suite and output tokens as web where scheduling is enabled.

Writing and debugging steps