๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—ง๐—ฒ๐˜€๐˜ ๐—ฆ๐˜‚๐—ถ๐˜๐—ฒ ๐—œ๐˜€ ๐—Ÿ๐˜†๐—ถ๐—ป๐—ด ๐—ง๐—ผ ๐—ฌ๐—ผ๐˜‚

AI agents make coding fast. They build a feature. They write the tests. The CI is green. You ship the code.

Then the app crashes in production.

Tests written after the code are not tests. They are records of what the code does. If the code has a bug, the test accepts the bug.

AI agents make this worse. They create a loop.

You never see the error. The spec is ignored.

Telling an AI to write better tests does not work. To the AI, a passing test is a success. The AI does not know the test is wrong.

The fix is the order. Tests must come from the spec, not the code.

Set your rules first:

Discipline is not enough. AI is too fast. You need a system to enforce this. Use a CI check or a git hook. Block any code arriving before its tests.

Do not accept tests born from the same context as the code. This is the only way to trust your green suite.

How do you stop tests-after-code in AI PRs?

Source: https://dev.to/dcstolf/your-test-suite-is-lying-to-you-21a8 Optional learning community: https://t.me/GyaanSetuAi