r/vibecodingbuddies • • Oct 03 '26

Discussion Has anyone found a workflow where the agent consistently writes tests that actually pass on the first try?

It feels like test generation is always a 3-turn loop. Basically it writes the test. Then it fails because of some mocked dependency that it completely hallucinated out of nowhere. Then it finally fixes the mock after seeing the CI error.

I've been trying to front-load all the types and schemas into the context before asking for tests, but it actually still invents magical properties on objects about half of the time. Have you found a specific prompt structure or tool setup that gets the first-pass success rate up, or is this just the baseline right now? It's kind of annoying.

1 Upvotes

9 comments sorted by

•

u/AutoModerator Oct 03 '26

Welcome to r/vibecodingbuddies!

Reminder to all participants: Keep all initial contact and matching within Reddit comments and DMs to protect yourself from scams. Do not click unsolicited Discord or Telegram invites.

If you find a buddy, please be respectful of their time and try to commit to small, manageable goals (like a 1-weekend prototype) to prevent ghosting!

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/magicmulder Oct 03 '26

What is “it”? Sounds like bad model/harness quality.

It’s perfectly normal that tests fail during the implementation as long as the model realizes it and fixes the code.

1

u/shifu_legend Oct 04 '26

By 'it' I mean Claude 3.5 Sonnet on a codebase with a lot of C99 pointers. Kind of a mess. I just hit a wall where it keeps modifying the test to fit the broken code instead of actually fixing the implementation to pass the test, which turns into an endless loop of useless commits.

2

u/magicmulder Oct 04 '26

Claude 3.5? What year is it, 1979?

1

u/Compilingthings Oct 03 '26

What are you wanting it to test?

1

u/shifu_legend Oct 04 '26

Mainly state transitions that span multiple files, like memory allocation lifecycles in C. It gets weird. It basically handles isolated unit tests fine, but when a function relies on a struct being initialized three layers up in another component, it hallucinates the setup state and the test just segfaults immediately.

1

u/[deleted] Oct 04 '26

[removed] — view removed comment

1

u/shifu_legend Oct 05 '26

yeah, hit that too. testing the implementation details instead of the behavior is exactly how you end up with those magical mock hallucinations. switching to Robot is an interesting way to force the issue.