Writing AI Test Cases
Updated Jul 2026

Documentation › Writing AI Test Cases

Writing AI Test Cases

User  One of the two main ways to build a test in MaxTAF. The other is the recorder.

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.

On this page

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:

AI test case ≠ AI Assistant

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

  1. Go to Dev ▸ Workspace and, on the List tab, click Create.
  2. Give it a unique name and choose the AI type.
  3. Open the Script tab and write your steps in plain English (see below).
  4. 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:

DoWhy
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 plainlyLogin 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:

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.
Run assertions from the main frame

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.

You often don't need the recorder commands by hand

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.

ParameterPurposeDefault
mx.playwright.enable_video_recordingRecord an MP4 of the AI run.false
mx.playwright.aggressiveness_levelHow aggressively the agent's loop-detection intervenes (1 = original, 2 = moderate, 3 = relaxed).3
mx.run.time_to_liveMaximum run duration in seconds.300
mx.record_maximoMaster switch to record the run into an MXML case.false
mx.recorder.project_nameTarget project id for the generated MXML case.
mx.recorder.maxtaf_urlMaxTAF base URL for uploading the generated case.
mx.recorder.maxtaf_api_keyAPI key used to upload the generated case.
mx.maximo.addressMaximo URL the agent navigates to / bakes into the generated case.
mx.maximo.username / mx.maximo.passwordOptional Maximo credentials for automatic login.
mx.maximo.logoutLog out at the end of the run.false
Recording needs both the switch and the credentials

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:

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:

Next steps

Learn the language your recordings produce in the MXML Reference, or read the Maximo Testing Playbook for Maximo-specific patterns.