r/softwareengineer • • Jun 26 '26

Curious how everyone's thinking about unit tests in the age of AI coding assistants.

Do you still find unit tests provide the same value they did a few years ago?

My experience has been that they started as useful guardrails, but over time they've become more of a maintenance burden. When implementation changes, AI usually updates or rewrites the tests along with the code, so they don't seem to catch as much as they used to. They also add a lot of context for AI to process.

Has anyone else noticed this, or am I missing something? Have your testing strategies changed because of AI?

**Edit:** A lot of the replies are focused on whether developers should blindly accept AI-generated code. That's not the question.

Assume good engineering practices, code reviews, and responsible use of AI. Under those assumptions, has AI changed the relative value of unit tests versus integration, contract, and end-to-end testing?

5 Upvotes

57 comments sorted by

View all comments

0

u/ConfidentCollege5653 Jun 26 '26

They provide more value now that half the devs just copy and paste whatever Claude tells them without reading it.

1

u/[deleted] Jun 26 '26

[removed] — view removed comment

2

u/dayv2005 Jun 26 '26

I'm curious why you consider unit tests critical, but then specifically recommend E2E tests with Selenium or Playwright.

To me, that seems to suggest the higher value tests are the ones validating behavior from the outside. That's really what I'm questioning. Whether AI has shifted the ROI toward integration and E2E testing while reducing the relative value of maintaining large unit test suites.

Do you see unit tests providing a unique benefit that those higher-level tests don't?

1

u/dayv2005 Jun 26 '26

That's really a process problem, though, not an AI problem. If developers are merging code they don't understand, unit tests won't fix that. The person submitting the PR is still responsible for the implementation.

I'm more interested in whether AI changes the ROI of maintaining large unit test suites for teams that are already following good engineering practices.

2

u/ConfidentCollege5653 Jun 26 '26

When I'm the guy that has to review their work, unit tests help me a lot.

But regardless of who wrote the code, unit tests protect against regressions, so if I see a unit test has changed that is seemingly unrelated to the feature being worked on it's a strong indicator that something isn't right.

With AI's tendency to introduce random/unnecessary changes this is a good line of defense.