CycleMantle
Workflows

Data generator walk-through for your first fixture file

03
Fixture in a minute

From an empty folder to a green test run

You have a PHP function that formats an order total, and you want it checked against several inputs. CycleMantle acts as the data generator: it writes a JSON file of invented orders, then writes the checks that read it. Nothing is copied from real customers. With a cloud model, your prompt and the file text the agent reads go to that provider; with a local model nothing leaves your PC. Plan on about 4 short chat messages: open the folder, ask for the records, ask for the checks, and run them. Each message produces cards that you can read, accept or reject before the next one starts. Read the cards from top to bottom: each one names a tool, the file or command it used, and the result it got. If you prefer to read before anything runs, start the chat in Plan only and switch to Ask first after you have read the plan.

01

Open the project folder

Start the app, choose the folder that holds your PHP code and pick Ask first as the approval mode, so that every change waits for you. You can switch the mode later whenever you want, for example to Auto-run once you trust the steps.

02

Ask for made-up records

Describe the fields you need, such as name, date and amount, and ask for a JSON file of invented rows. Say how many rows you want. Keep every name, address and amount clearly fake, so nobody mistakes a row for a real person.

03

Ask for the checks

Request a small test script that reads the JSON file and compares known inputs with expected outputs. Name the function it should test. Ask the agent to explain each check in one line, so you know what it is meant to catch.

04

Review and run

Read the diff, accept it, and let Shell run your test command. Then read the exit code and expand the card to see the output. If a check fails, ask the agent to explain the failure before it edits anything.

A small test script to start from

tests.php
<?php
function discount(int $cents, int $percent): int {
    return intdiv($cents * (100 - $percent), 100);
}
assert(discount(1000, 0) === 1000);
assert(discount(1000, 10) === 900);
assert(discount(0, 50) === 0);
assert(discount(999, 100) === 0);
echo 'All checks ran';

One plain function and four assert checks with known inputs and results. It uses no database, no network and no secrets. Later the agent can swap the fixed numbers for rows from your JSON file, and the checks keep the same shape. Change one expected value on purpose to see a failure. Save it as tests.php in your project folder, run it with your test command, and read the exit code in the card before you ask for anything more. Then change one expected value on purpose and watch the card turn red.

Four jobs for test data generation tools

Write the sample records

Many people wonder how to generate test data faster than by hand. Describe the shape you want and let the agent write it: a JSON file with 3 invented customers, each with a name, a signup date and an order amount. Among test data generation tools, a plain file in your project is the easiest to read and to change later, because the diff shows every value. glob and list_dir show where fixtures already live, so the new file lands next to the others. Open the card, check that every value is clearly made up, and edit odd rows by hand before you accept. Use reserved example domains for emails. Ask for a handful of rows, not hundreds, so you can read every one. Write dates in one fixed format so every row reads the same.

Write checks that read the file

Ask for a script that loads the JSON and checks one result per row. The agent opens your source with read_file, finds the function with grep, and proposes the test file as a diff. Mocking static methods in php is awkward, so ask the agent to list static calls before it writes anything, and keep those calls behind a small function that a test can replace. Ask first holds the change until you accept it. Read each assertion and ask whether it would fail if the function were wrong. Reject any check that only repeats the code it tests. Then add one row that should fail on purpose. If the agent cannot tell which function you mean, name it in the prompt and mention the file. Keep one concept per test.

Run the tests and read the exit code

Shell runs your test command in the environment you chose, such as local Windows, WSL or SSH to a server you own. The card shows the real exit code, and a zero exit code means every check passed while any other value means a failure. Expand the card to read the output line by line. If something fails, the agent reads the message and proposes a fix as a diff. Do not accept a fix just because it turns the run green. Check the expected value in the test first. If a second failure follows, ask the agent to explain the first one before it edits again. Plan only is a good first pass if the command is new to you, because the agent then writes a plan and runs nothing.

Decide which code needs a test

Once the tests pass, run your coverage command and let the agent read the report. Teams argue whether to include infrastructure code in code coverage, and the sensible answer is to agree on it before the number becomes a target. Some teams also demand mandatory test coverage for critical methods, such as price or permission checks. Ask the agent to list those methods with grep and propose tests for the first one. Review the diff, run the tests again, and stop when the critical paths are covered. Write down which folders you counted, so next month's figure means the same thing. Ask the agent to put the list of counted folders into a plain text file in your project, and read the diff before you accept it.

CycleMantle for Windows

Generate your first fixture today

Download CycleMantle ↗