Let Copilot generate tests and keep rerunning them

A commenter configured GitHub Copilot to keep executing tests and fixing failures until they passed, with a human approving each terminal step.

Done with GitHub Copilot· Intermediate

What they did
They added custom instructions to GitHub Copilot so that test-writing jobs would not stop at the first failure. In practice, Copilot produced a test, launched it, hit a failure, then tried again with a "--info" option to gather more detail before changing the code and running the checks once more. The person stayed in the loop only to approve each terminal command.
How it went
In that example, the process ended with the test passing after three approved runs. The drawback was that Copilot still needed a permission click before every terminal action, even though the debug-and-retry cycle was automatic.
Tips
This is useful if you want an agent to handle the repetitive part of test fixing but still keep control over execution. Expect to confirm each command one by one when your setup requires terminal approval.

Try it yourself with GitHub Copilot

Use GitHub Copilot to help with [project, file, or feature]. First, add or update tests for [specific behavior] with [test framework]. Then run the tests, check the failures, make a targeted fix, and run them again. Repeat that loop until the tests pass. Before any action that would install software, remove files, or send/submit something, pause and ask me to approve it. When you finish, summarize the tests you added and the changes you made.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.