zrizDocsLearnSecuritySign inSign up

End-to-end tests an AI agent can write

Give your coding agent one instruction. It installs the zriz CLI, writes one test for a flow of your service, and runs it. The work is done when the run has status pass.

Draft. Guide · zz 0.4.0 or later · Updated · Plain text for agents: /docs/agent-e2e-tests.md

The agent works in the folder of your service. You do two things: you paste the instruction, and you approve one login.

Before you start

1. Give the agent the instruction

Do

Start your service. Start the agent in the folder of your service, and paste the text below.

Read https://zriz.io/llms.txt and obey its rules.
Do its start commands in this folder. The base URL of the service is <url>.
Run `zz guide`. Then write one pipeline that tests this flow: <flow>.
You are done only when `zz run` of that pipeline answers status `pass`.
If a step needs me, stop and tell me what to do.

The first line of the text needs a network. Check that this machine can read the rules:

curl -fsSL https://zriz.io/llms.txt

Why

Each command of zz prints one JSON object, and its hints name the next command. zz never asks a question, so the agent works alone until the login.

You should see

# zriz
## Rules

If not

2. Approve the login

Do

Your user must approve the login in a browser tab. The zz login of the agent opens the tab. Sign in if asked, then click Yes, connect.

The step Log in of the quick start gives the case of a machine with no browser.

With many logins, the agent uses --org <login name or org id>, for example zz --org work run hello. It does not use zz switch <login>, because that changes the file for every terminal.

After the approval, check the login:

~/.local/bin/zz doctor

Why

The login gives this computer an API key of your org. An agent cannot sign in for you.

You should see

{"ok":true,"command":"doctor",
"name":"logged in","ok":true

If not

3. Find the run of the agent

Do

Wait until the agent says that it is done. Then do the command in the folder of your service.

Find a row whose pipeline is not the sample hello. Its pipeline is the test that the agent wrote.

~/.local/bin/zz runs

Why

The command lists each run of this project. A row names the pipeline and the status, so you do not depend on the words of the agent.

You should see

{"ok":true,"command":"runs",
"pipeline":"<pipeline>"
"status":"pass"

If not

4. Run the test

Do

Read the file .zriz/pipelines/<pipeline>.json. Its steps must be the flow that you named.

~/.local/bin/zz run <pipeline>

Why

A run that you start shows that the test passes now, against your service as it is.

You should see

"status":"pass"

If not

Next