Search
English

When AI-written tests all pass but are hard to trust, Stryker measures test strength by deliberately breaking the code(qiita.com)

startupxo Discuss

Writing language: KoreanRead in the original language

Plain summary

- Even if all tests pass, you cannot tell whether those tests actually catch mistakes. Mutation testing deliberately breaks the code in small ways and then checks whether the tests fail. If they fail, the mutant was caught; if they pass, it was missed. Stryker is a tool that automates this process. - The author's team applied it to a Prisma client (131 models) that automatically filters data per company. The definition table listing per-model conditions was 100% from the start, and the hand-written client tests became 100% after being supplemented at 89.74%. - Among the missed cases was a test where an attempt to delete another company's row failed because of a foreign key constraint, not the per-company filter. The bind call the AI added following a review comment turned out to be unnecessary code, since removing it left behavior unchanged. - In the author's environment, 407 mutants took 3 minutes 30 seconds, and when the scale grew to 1,326, it took 24 minutes. They had to specify only the real-DB tests so unrelated tests would not run, and the author is considering running it once before a PR.

Editorial opinion

O: In a multi-tenant SaaS, a backend developer who owns the per-company filter is encouraged to run Stryker before a PR, using --mutate on just the one file that must never be wrong. X: In the author's setup, 407 mutants took 3 min 30 sec, and when it grew to 1,326 mutants it took 24 min. Tests unrelated to the file also ran, so you should specify only the real-DB tests.
Writing language: Korean

Read source ↗

Found on

Qiita ↗ / Published by source

Have you run into something like this? Tell us in a line or two what you did. You do not need to know the product.

Sign in to comment

Keyboard shortcuts

Choose a post with J and K or the arrow keys, then press Enter.

K ↑ / J ↓
Previous post / next post
Enter C
Open summary and comments for the selected post
O
Open the original link of the selected post
/
Search
?
Show this help
Tab
Move to the submit or comment button, then press Enter

Type normally in text fields. Tab and Enter are always available.