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.
- 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.
Related agent uses
Update a codebase with Copilot in chat and agent mode
A developer used GitHub Copilot to make code changes and preferred the CLI’s autopilot workflow and todo list.
Use Copilot for narrow coding tasks only
A developer first let GitHub Copilot Agent Mode handle most coding, then restricted it after losing track of their own code.
Have Copilot plan, patch, and open the PR for you
A developer used GitHub Copilot to shape a ticket into a plan, make the edits, and prepare the ticket and pull request after a manual check.
Assign a GitHub issue to Copilot and review the PR
A developer used GitHub Copilot to tackle a backlog issue, then checked its branch choice, tests, and pull request before deciding what to merge.
Move a project from OpenAI API to OpenRouter
A developer let GitHub Copilot handle a staged switch from OpenAI API calls to OpenRouter and then checked the commit details it generated.
Use Copilot Agent Mode on notebook edits carefully
A user tried Copilot Agent Mode on a large Jupyter notebook and had to revert repeatedly after it damaged the file mid-edit.