mo-qa
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRun QA with Mo
使用Mo执行QA测试
Mo is Momentic's autonomous QA engineer. It runs in a hosted sandbox, where it
can test web applications with a browser, inspect network traffic, run code and
shell commands, delegate exploration, and report test cases and product bugs.
Treat its filesystem and environment as remote, not as the user's machine.
Mo是Momentic的自主QA工程师。它运行在托管沙箱(sandbox)中,可通过浏览器测试Web应用、检查网络流量、运行代码和shell命令、委托探索任务,并报告测试用例和产品缺陷。请将其文件系统和环境视为远程环境,而非用户本地机器。
Install and authenticate
安装与身份验证
bash
curl -fsSL https://cli.momentic.ai/mo | sh # installs to $HOME/.local/bin/mo
mo --versionEvery command needs an API key. Set in the environment;
prefer this in CI. For an interactive login, use:
MOMENTIC_API_KEYbash
npx @momentic/wizard@latest loginThis writes . Do not pass API keys as command arguments,
print them, paste them into a session message, or commit them.
~/.momentic/auth.jsonbash
curl -fsSL https://cli.momentic.ai/mo | sh # installs to $HOME/.local/bin/mo
mo --version每个命令都需要API密钥。在环境变量中设置;在CI环境中推荐使用这种方式。如需交互式登录,请使用:
MOMENTIC_API_KEYbash
npx @momentic/wizard@latest login此命令会将登录信息写入。请勿将API密钥作为命令参数传递、打印、粘贴到会话消息中或提交到代码仓库。
~/.momentic/auth.jsonWrite the QA brief first
先编写QA测试说明
Treat the brief as the whole input. A vague brief produces a vague bug bash.
Mo's browser runs outside the developer machine, so the target must be
reachable from the public internet: use a deployed environment or preview URL,
never .
localhostState in the brief:
- Target URL: Include the exact path and query the change affects.
- Expected behavior: Explain what changed and what it should now do in product terms.
- Sign-in instructions: Name the login method and test account to use.
- Test data rules: State what Mo may create and what it must not touch.
- Out-of-bounds actions: Call out deletions, payments, emails, production data, bulk operations, and any other destructive action. Mo may take destructive actions if the brief invites them.
- Acceptance criteria: List the checks that decide pass or fail.
Ask the user for any missing item before starting Mo. Do not invent scope,
credentials, test data permissions, or acceptance criteria.
请将测试说明作为完整输入内容。模糊的说明会导致模糊的漏洞排查结果。Mo的浏览器运行在开发者机器之外,因此测试目标必须能从公网访问:请使用已部署的环境或预览URL,切勿使用。
localhost测试说明中需包含:
- 目标URL:包含变更影响的精确路径和查询参数。
- 预期行为:从产品角度说明变更内容以及现在应实现的功能。
- 登录说明:指定登录方式和要使用的测试账号。
- 测试数据规则:说明Mo可以创建哪些数据,以及绝对不能触碰哪些数据。
- 禁止操作:明确标注删除、支付、发送邮件、操作生产数据、批量操作等任何破坏性操作。如果测试说明允许,Mo可能会执行这些破坏性操作。
- 验收标准:列出判定测试通过或失败的检查项。
在启动Mo之前,请向用户确认任何缺失的信息。请勿自行设定测试范围、凭据、测试数据权限或验收标准。
Run a session
启动会话
Write the brief before invoking the CLI, then pass it as one quoted argument:
bash
brief=$(cat <<'EOF'
Target URL: https://preview.example.com/checkout?variant=express
Expected behavior: Express checkout now keeps the selected shipping method when the customer returns from payment.
Sign-in: Use the staging QA buyer account already provisioned for Mo.
Test data: Create test carts and orders only. Do not modify shared catalog data.
Out of bounds: Do not submit payment, send emails, delete data, or run bulk operations.
Acceptance criteria:
- The selected shipping method remains selected after returning from payment.
- The order total does not change.
- Standard checkout still works.
EOF
)
session_json=$(mo start "$brief")
session_id=$(jq -r .sessionId <<<"$session_json")
web_url=$(jq -r .webUrl <<<"$session_json")Starting returns before Mo finishes. Preserve both values: every later command
needs , and the user can watch or join through .
session_idweb_url在调用CLI之前先编写测试说明,然后将其作为一个带引号的参数传入:
bash
brief=$(cat <<'EOF'
Target URL: https://preview.example.com/checkout?variant=express
Expected behavior: Express checkout now keeps the selected shipping method when the customer returns from payment.
Sign-in: Use the staging QA buyer account already provisioned for Mo.
Test data: Create test carts and orders only. Do not modify shared catalog data.
Out of bounds: Do not submit payment, send emails, delete data, or run bulk operations.
Acceptance criteria:
- The selected shipping method remains selected after returning from payment.
- The order total does not change.
- Standard checkout still works.
EOF
)
session_json=$(mo start "$brief")
session_id=$(jq -r .sessionId <<<"$session_json")
web_url=$(jq -r .webUrl <<<"$session_json")启动命令会在Mo完成前返回结果。请保留两个返回值:后续所有命令都需要,用户可以通过查看或加入会话。
session_idweb_urlFollow the turn reliably
可靠跟进会话进度
Poll the active session with :
statusbash
mo status "$session_id"It returns the current run state, latest visible message, web URL, and
structured QA findings. Always inspect , ,
, and ; they contain more evidence than
Mo's closing prose.
findings.testCasesfindings.bugsfindings.controlsfindings.verdictsUse when waiting for output or retrieving the transcript and pending
input. Prefer bounded 30-60 second reads so the caller stays responsive:
readbash
mo read "$session_id" --from start --timeout 45s --jsonUse for reliable polling. It replays the visible transcript, so
deduplicate messages when automating. Repeat until the expected assistant reply
appears and is , , or . A
response means Mo is still working. If is present, answer it with
.
--from startstateidlewaitingOnUserstoppedtimedOut: truependingInputsendDo not rely on after or : it only captures output
produced after the read begins, so a fast turn can finish and return no
messages. A timeout accepts , milliseconds, seconds, or minutes such as
, , or , up to .
--from lateststartsend0500ms45s4m290sstatus.stateread.state使用命令轮询活跃会话:
statusbash
mo status "$session_id"该命令会返回当前运行状态、最新可见消息、Web URL以及结构化的QA测试结果。请务必查看、、和;这些内容包含比Mo的总结性文字更详细的证据。
findings.testCasesfindings.bugsfindings.controlsfindings.verdicts等待输出或获取会话记录和待回复内容时,请使用命令。推荐设置30-60秒的有限超时时间,以便调用方保持响应性:
readbash
mo read "$session_id" --from start --timeout 45s --json使用进行可靠轮询。该参数会重播可见的会话记录,因此在自动化时需要对消息进行去重。重复执行该命令,直到出现预期的助手回复且为、或。如果返回,说明Mo仍在运行。如果存在,请使用命令回复。
--from startstateidlewaitingOnUserstoppedtimedOut: truependingInputsend在或之后,请勿依赖参数:它仅捕获读取开始后产生的输出,因此快速完成的会话可能不会返回任何消息。超时时间可以设置为、毫秒、秒或分钟,例如、或,最长不超过。
startsend--from latest0500ms45s4m290sstatus.stateread.stateContinue or stop a session
继续或停止会话
Send a follow-up or answer:
bash
mo send --session-id "$session_id" 'Use the staging account and continue'
mo read "$session_id" --from start --timeout 45s --jsonIf Mo is working, steers the live turn at its next tool-step boundary.
Otherwise it starts a new turn in the same session. A successful only
means the message was accepted; confirm that the transcript advances to a new
assistant reply. After a stopped turn, a new can resume the session, but
an immediate read may briefly show the previous stopped state.
sendsendsendStop only the active turn:
bash
mo stop "$session_id"Allow a few seconds for propagation, then verify with
that the state is . Stopping
does not delete the session, and already-running sub-agents may finish
independently.
read --from start --timeout 0 --jsonstopped发送后续指令或回复:
bash
mo send --session-id "$session_id" 'Use the staging account and continue'
mo read "$session_id" --from start --timeout 45s --json如果Mo正在运行,会在其下一个工具步骤边界处引导当前会话回合。否则,它会在同一会话中启动新的回合。成功仅表示消息已被接收;请确认会话记录已更新至新的助手回复。在会话回合停止后,新的可以恢复会话,但立即执行可能会短暂显示之前的停止状态。
sendsendsendread仅停止当前活跃的会话回合:
bash
mo stop "$session_id"请等待几秒以确保状态同步,然后使用验证状态是否为。停止操作不会删除会话,已运行的子Agent可能会独立完成任务。
read --from start --timeout 0 --jsonstoppedTransfer files
文件传输
uploadbash
remote_path=$(mo upload --session-id "$session_id" ./fixture.csv fixture.csv)
mo send --session-id "$session_id" "Use the sandbox file at $remote_path."
mkdir -p .momentic-artifacts
mo download --session-id "$session_id" --output .momentic-artifacts "$remote_path"If names a directory, create it first. A nonexistent output path is
treated as a target filename. Without , downloads use
, then .
--output--outputMOMENTIC_ARTIFACTS_DIR<current-directory>/.momentic-artifactsuploadbash
remote_path=$(mo upload --session-id "$session_id" ./fixture.csv fixture.csv)
mo send --session-id "$session_id" "Use the sandbox file at $remote_path."
mkdir -p .momentic-artifacts
mo download --session-id "$session_id" --output .momentic-artifacts "$remote_path"如果指定的是目录,请先创建该目录。不存在的输出路径会被视为目标文件名。如果未指定,下载文件会保存到,其次是。
--output--outputMOMENTIC_ARTIFACTS_DIR<当前目录>/.momentic-artifactsCommand reference
命令参考
| Command | Purpose and important arguments |
|---|---|
| Create a cloud session and begin its first turn; return |
| Read transcript and turn state; prefer |
| Return the latest message, web URL, backend run state, and structured QA findings. |
| Steer active work or start the session's next turn. |
| Stop the active turn without deleting the session. |
| Upload one local file and print its remote sandbox path. The optional destination is a remote filename. |
| Download a sandbox path or durable artifact and print the local path. Use |
| 命令 | 用途及重要参数 |
|---|---|
| 创建云端会话并开始第一个回合;以JSON格式返回 |
| 读取会话记录和回合状态;推荐使用 |
| 返回最新消息、Web URL、后端运行状态以及结构化的QA测试结果。 |
| 引导正在进行的任务或启动会话的下一个回合。 |
| 停止当前活跃的会话回合,但不删除会话。 |
| 上传一个本地文件并打印其在远程沙箱中的路径。可选的destination参数为远程文件名。 |
| 下载沙箱中的文件或持久化工件并打印本地路径。使用 |