Two of the reasons I never liked writing tests is
- they didn’t seem to usually assert much internal logic
- they would have to be maintained along with the original code
I think scenario testing is much better instead because the actual way a person uses a feature hardly changes but the internals might change a lot.
So imagine I’m making an e-commerce website. There are lots of internal mechanisms. I’ll have an agent testing all the functionalities as if it were a customer. This gives me much much more confidence while writing code because it is more uncorellated with the code.
Tomorrow I can change a lot of internals but the testing agent stays the same.
There’s something to note though: not all code is possible to be scenario tested. Like data engineering and other things where the feedback time is huge.
i feel like im going insane
How is scenario different from a behavior (as in Behavior-Driven Development)?
Gherkin and things like Cucumber are not something new, are they?
They write really good Gherkin features and then work inwards writing unit tests as they go - checking that they fail before implementation so it's actually testing something worthwhile.
And the code they ship is decent quality (not as good as me most of the time - but a LOT better than me when I'm tired or I'm pissed off about something or the work is really boring).
Are you an engineer ? You must test your "creation". Or would you expect that the microwave owen you just bougth will be tested by your child while getting burned ?
But not any more! Now I point the LLM to the code and order it to write unit tests, covering all edge cases, etc. I'd rather spend 3 hours arguing with the LLM than writing unit tests! :-D
If you find writing tests tedious enough to make using an LLM to write them seem like a good idea you're probably churning out repetitive tests, unnecessary tests, tests which aren't great at catching bugs.
In theory. The only difference between today and "the aughts" is that we have machines that can spit out a ton of code very quickly.
Nothing has changed about the discipline or honesty around testing (you can skip automated tests even faster now if you wish). You can and should work with AI to write tests, but you have to know the difference between a good test and a "looks good on paper" test in order for it to truly be effective and raise the quality of what you're building.
I've been building a compiler with LLMs for a memory safe language like Rust with near zero cost abstractions (no GC), but with WAY less cognitive overhead.
I can tell you right now:
1) It's 100x more than I could have achieved with zero compiler design experience.
2) I'm HIGHLY skeptical that LLMs can build something of this complexity (in some ways it's more difficult than implementing a Rust compiler) - so the testing is quite robust - 3 different systems (unit, integration, fuzz tests) each with mutant testing, each with between ~65-90% line coverage and ~50-80% branch coverage, combined with ~99% line coverage and ~86% branch coverage.
There is ZERO chance I could get something even close to this level of "working" by myself ever - let alone with minimal effort.
The test is kind of simple - if LLM's can do this... They should be able to do just about anything... Compilers are notoriously difficult to verify they actually work, rather than just kind of work sometimes...
People can say I'm wasting my time all they want.
But, one, it's been enlightening. I'm literally in awe of what they can do and have done.
Two, I've developed a bunch of tooling / metrics necessary to get them to be able to do something at this level of complexity without falling over themselves. And I think it can work at scale pretty easily.
Nearly all of the research comes from the 80s or farther back for the complexity metrics.
What you're thinking of is "no runtime" or "lightweight runtime", which does often mean "no garbage collector".
Automated verifiability goes down once a software project incorporates things like:
- Concurrency
- Networking / distributed systems
- Visuals / animations
- Domain knowledge (e.g. banking, finance)
- If you call the setter, the getter returns the same value - these are kinda bullshit and would be caught by the next level anyway
- Testing basic normal use
- Testing known difficulties of the implementation
- Exhaustive or randomized (if necessary) testing of the state space, ~= property-based testing
I expect AI to have very different levels of ability for these, not necessarily in strictly descending order as listed.
Unit tests and deterministic tests are hard to get right and need to be done at the correct boundary.
I have seen many people dogmatically pushing unit tests religiously but this often leads to very hard to maintain tests that mostly exist just to change along with the main code itself.
A good way to understand if your unit tests are good: are you changing them along with changing your actual code? Then it’s a bad test. I think the argument for “it’s just documentation” is weak.
Of course, if you’re just watching Claude changing both and saying “LGTM” then it’s not very valuable.
Unit tests are great for pure algorithms, like file format, data encoding, crypto,… etc. Everything with a specs that will rarely changes. You write your tests once and basically never have to update them.
But for requirements that changes often like in a enterprise settings or applications, maintaining a suite of unit tests is expensive. Integration tests are better because contracts between modules don’t change that much. Even if the suite are not exhaustive, they’re useful enough to catch some failures.
https://playwright.dev/docs/release-notes#version-159
If you set this up correctly, you can have a main agent issue natural language testing instructions to this playwright agent which returns a natural language summary of what it experiences. This is the sort of thing where I begin to get interested in the idea of agents working while I sleep.
Given your code-base is mature enough, please don't have a single Skill/Steering/Persona/Ruleset (or whatever) for your "QA Engineer." This is just the same "my behavioral file can one-shot the entire system build" kind of thinking that will give you expensive, marginal results as the system grows.
If you want to have success in this space, get really fine-grained. Every single test scope needs its own behavioral files.
Have your core behavioral file define some simple specifics around Test Pyramid, Test Purposes, checks for tautological tests, etc. Then get _really_ specific;
<test-type>-architect (plan)
<test-type>-engineer (execute)
<test-type>-resolver (problem solver, maintenance, how to manage a failure, etc.)
e.g., playwright-architect, etc.
Then create additional ones for Unit tests, API tests, contract tests, or any other required test layer for the SUT.
Overengineered? Maybe given the size of your codebase. But for anything significant, you are codifying what humans and their skillsets do.
Ten million blackboxes with ten billion tests or whatever. Otherwise it’s literally the blind leading the blind
If so, if this is meant to imply that LLMs are just another step towards higher-level abstractions, the analogy doesn't quite work. Unlike a COBOL compiler, the LLMs output can't be predicted or reasoned about, so you can't really fix bugs in your program (i.e. your prompt) but only try to permute it haphazardly and hope for the best.
[1] https://ethw.org/Milestones:A-0_Compiler_and_Initial_Develop...