Documentation › Writing AI Test Cases
Writing AI Test Cases
An AI test case is a test you write in plain English. When you run it, MaxTAF drives an AI agent that controls a real browser to carry out your steps — and, for Maximo, it can record everything into a reusable MXML case that replays with no AI cost.
What an AI test case is
Alongside MXML, Java, Python and JavaScript, AI is a first-class case type in MaxTAF. Instead of code, its script is a list of natural-language instructions. At run time MaxTAF sends those instructions to an AI agent that opens a real browser and performs them — clicking, typing, navigating and asserting — the way a person following your steps would.
This is ideal for:
- Getting started fast — describe a test in words, no locators or code required.
- Exploratory and one-off checks — the agent adapts to what it finds on screen.
- Authoring by demonstration — run the AI case once against Maximo and let it hand you a deterministic MXML case for your regression suite.
The AI Assistant (Learn ▸ chat) is a chat helper that writes/debugs code for you. An AI test case is a runnable test the agent executes. This page is about the latter.
Creating an AI case
- Go to Dev ▸ Workspace and, on the List tab, click Create.
- Give it a unique name and choose the AI type.
- Open the Script tab and write your steps in plain English (see below).
- Save, then press Run and confirm. Follow the browser live in the run panel.
Writing good steps
The agent is capable but literal — clear steps produce reliable runs. The following practices come straight from MaxTAF's verified example scripts:
| Do | Why |
|---|---|
| One action per line. | Keeps each instruction mapped to a single browser action. |
| Name things exactly — "Click the New Asset button", "the Asset Number field", "the Assets application". | Vague steps make the agent guess. |
| State the login plainly — Login with username "marko" and password "…". | The agent handles the auth flow itself. |
| Add explicit waits — "Wait for the asset form to load." | Don't assume instant page transitions. |
| Make assertions explicit — say what value you expect. | Asserts the intended value, not whatever happens to be on screen. |
| End by reporting — "Report what was checked." | The agent must finish with a pass/fail result (a run is invalid otherwise). |
| Use unique, generated case names when creating recorded cases (append a timestamp). | Avoids overwriting earlier cases. |
Two useful literal instructions the agent understands:
Navigate to <url>— go to a page.Evaluate expression: <JavaScript>— run raw JavaScript in the page (this is how the recorder is driven headlessly — see Capturing MXML).
A worked example (Maximo)
This verified script logs into Maximo, creates an asset, asserts a field value, and captures the flow as an MXML case:
Navigate to https://your-maximo/maximo/oslc/graphite/manage-shell/index.html#/main
Start recording by executing: window.postMessage({ type: 'MXTAF_RECORDER_CONTROL', command: 'startWithClear' }, '*')
Login with username "marko" and password "markodelic12345".
Navigate to the Assets application.
Click the New Asset button to create a new asset.
Wait for the asset form to load.
Type a test value into the Asset Number field.
Execute the assertValue command from the MAIN FRAME (not from inside the iframe):
window.postMessage({ type: 'MXTAF_RECORDER_CONTROL', command: 'contextAction', action: 'assertValue', elementId: 'ASSETNUM@483' }, '*')
Stop the recording: window.postMessage({ type: 'MXTAF_RECORDER_CONTROL', command: 'stop' }, '*')
Create the case: window.postMessage({ type: 'MXTAF_RECORDER_CONTROL', command: 'createCase', name: 'AssertValueTest_' + Date.now() }, '*')
Report what actions were recorded and verify the assertValue action shows the correct value and elementId.
Maximo renders inside an iframe. Send contextAction commands from the top/main frame — MaxTAF searches all frames to find the element by its real DOM id. Don't switch into the iframe first.
When your project is configured to record automatically (mx.record_maximo=true plus recorder credentials), MaxTAF wraps your steps with the start/stop/create-case commands for you. In that mode you only write the business steps in the middle — logging in, navigating, asserting.
Parameters that control AI runs
Set these as project or case parameters (see the Parameter reference). Defaults are sensible; you rarely need all of them.
| Parameter | Purpose | Default |
|---|---|---|
mx.playwright.enable_video_recording | Record an MP4 of the AI run. | false |
mx.playwright.aggressiveness_level | How aggressively the agent's loop-detection intervenes (1 = original, 2 = moderate, 3 = relaxed). | 3 |
mx.run.time_to_live | Maximum run duration in seconds. | 300 |
mx.record_maximo | Master switch to record the run into an MXML case. | false |
mx.recorder.project_name | Target project id for the generated MXML case. | — |
mx.recorder.maxtaf_url | MaxTAF base URL for uploading the generated case. | — |
mx.recorder.maxtaf_api_key | API key used to upload the generated case. | — |
mx.maximo.address | Maximo URL the agent navigates to / bakes into the generated case. | — |
mx.maximo.username / mx.maximo.password | Optional Maximo credentials for automatic login. | — |
mx.maximo.logout | Log out at the end of the run. | false |
An MXML case is only recorded when mx.record_maximo=true and both mx.recorder.project_name and mx.recorder.maxtaf_api_key are set. Miss either and the run still executes, but nothing is captured.
Your AI provider (Claude, Gemini, OpenAI or a custom endpoint) and its key are configured once per project under Project Settings ▸ AI Configuration — not per case. See the User Guide.
How an AI case runs
Behind the scenes, an AI run flows through a small pipeline:
MaxTAF engine
│ POST to the AI hub (mx.playwright.server)
▼
Playwright hub ──picks an idle node──▶ Playwright node
│ spawns the AI agent
▼
AI agent ──drives──▶ real Chrome browser (with live view)
──tools──▶ report pass/fail, screenshots, logs
The agent must finish by reporting a result; MaxTAF turns that into the run's pass/fail. If the agent stops without reporting, or hits a critical error (for example a detected loop), the run is marked failed.
Capturing a reusable MXML case
The big payoff for Maximo testing: while the AI agent drives the browser, the MaxTAF recorder (loaded in the same browser) captures the flow and produces an MXML case. That MXML case:
- replays deterministically with zero AI tokens — perfect for a regression suite;
- uses MaxTAF's Maximo-specialised language, handling iframes and dirty-record prompts;
- is uploaded straight into the project you named in
mx.recorder.project_name.
So the pattern is: author once with AI, run forever as MXML. The headless recorder commands (startWithClear, stop, createCase, contextAction) are documented in the Recorder Guide.
Reading the results
Open the run in Ops ▸ Runs and expand the details:
- Console output — this is where the AI agent's live log goes: each assistant message, tool use, tool result, screenshot and error. This is how you see what the AI actually did.
- Log — separate, non-AI execution info.
- Run Report — a rich HTML report if the agent produced one.
- If recording was on, the generated MXML case appears in the target project's Workspace.
Learn the language your recordings produce in the MXML Reference, or read the Maximo Testing Playbook for Maximo-specific patterns.