I asked, “Do you have your coding agents include automated tests for the code that they write?”
I’m firmly on team red/green TDD for agent code.
I like having a test suite that protects against them breaking old features when they make new changes.
I also don't care if most of their tests survive changes though, because they are so cheap to rewrite.
For conformance-style tests, such as tests for writing a parser, those I'll dictate the shape of.
I agree that's still the gold standard for great tests. The human overhead cost of not "great" tests has fallen so much, and I find value in them where I wouldn't have found value before.
I use automated tests to make side projects more durable, and I have explored workflows where language models help write tests, fix failures, and iterate until tests pass. These practices connect to ai generated software documentation when tests also inform documentation and to agents as everyday coding tools for broader examples of using coding models in practical work.
When a good test suite is available, I can have a coding agent run it to check that its changes did not break anything.
I make sure I can run git diff myself later to inspect what the agent changed.
I built an HTML5 parser by having Codex work through the html5libs-test suite, a process that took a few hours.
The html5libs-test suite I used for the parser contains 9,200 tests.
I recommend encouraging most coding agents to use test-first development for much better results.
With Red/green TDD, I have an agent watch tests fail before building an implementation that makes them pass.
I have always been much more interested in integration tests than lower-level tests.
When maintaining tests is expensive, I think it is important to have the highest-value, most refactor-supporting tests possible.
Maintaining tests is much cheaper now.
I described a Claude 3 transcript as “probably the most interesting Claude 3 transcript.”
In the workflow, I pipe in my entire codebase before asking Claude to write tests.
I prompted Claude to “fill out the test_files_to_prompt.py with tests”.
I feed Claude a test failure for it to fix.
I then told Claude to “Fill out the Usage section of the README”.
I released files-to-prompt, which I built almost entirely through prompting Claude 3 Opus.
I completely agree that nothing increases the longevity of a side project more than a basic set of automated tests for it.
I pointed readers to “Coping strategies for the serial project hoarder,” a talk I gave at DjangoCon 2022.
I described a test-driven workflow where I define the tests first, then run a Bash script that iterates until the tests all pass.
I shared the command ./tdd.sh https://t.co/bc2pM5yW8Q https://t.co/XusAbSCLne.
@codeinthehole shared a Bash script for iterative test-driven development, and I called it “so cool.”
I said my coding agents ALWAYS write tests.
I said all of my projects have a tests/ folder before I fire up the agent.
I asked, “Has anyone seen a coding agent start an automated test suite when one doesn't exist already, without being prompted to do so?”
I wondered, “maybe they're picking up on that?”
Related: testing and validating generated code, engineering quality with agents, agent testing and qa