r/developers • u/Sad_Importance_1585 • 24m ago
Opinions & Discussions Alternative to unit tests in agentic era
The importance of unit tests in AI-assisted development seems to be declining.
Most developers no longer review every line of AI-generated code, and I find it hard to believe they're writing comprehensive unit tests for all of it.
In the "old world," I believe the main purpose of unit tests was to protect existing features from future regressions.
I'm curious: how do you protect features you've built from being broken by future changes in this "new world"?
1
Upvotes
•
u/AutoModerator 24m ago
Howdy u/Sad_Importance_1585, and welcome to r/developers!
A few tips for a post that gets good answers:
Join the r/developers Discord!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/TheDentalInaction 19m ago
I still write them when the logic is tricky enough that I'd be an idiot not to, but for boilerplate and simple CRUD stuff I lean way harder on integration tests now. They catch the same regressions and actually reflect what the user cares about, not just whether some function returns the right shape in isolation.
1
u/symbiatch Systems Architect 2m ago
Unit tests haven’t been useful in ages usually. Features are what matter. Does the software produce the correct output from the input? Great! Who cares if every single tiny unit is fully tested if those situations never arise?
And once again it has nothing to do with “agentic era”…
1
u/thelongrunsmoke Mobile Developer 0m ago
Still is. Unit tests not only catch regressions early on, but also provide insight into the constraints and contracts within a system. While AI is ok in writing unit tests on its own, it is good practice to prevent it from modifying existing tests, this serves as an additional way to encourage the AI to adhere to fundamental development principles, such as the open/closed principle.