Menu

The Bug My Unit Tests Didn't Catch: An Infinite Loop in Mutation Testing
πŸ“°

The Bug My Unit Tests Didn't Catch: An Infinite Loop in Mutation Testing

DEV Community: goΒ·Narek KostanyanΒ·4 days ago
#cJuZJNUs
#devtogo#devto#dev#test#loop
Reading 0:00
15s threshold

Who the hell writes a unit test for an infinite loop? Well, now that's me πŸ˜‡

When I started working on gooze , my goal was simple: a mutation testing tool for Go that is easy to shard in CI, so a big project can split the work across many machines. Before gooze, I tried to add this to an existing Golang mutation testing tool: I refactored it in a private fork, and failed miserably. So I started from scratch.

If you are not familiar with the concept of mutation testing, it checks whether your tests have holes that bugs can slip through ( what is mutation testing ). It does this by adding small, controlled bugs to your code on purpose. It turns < into <= , || into && , true into false , then runs your tests. If the tests still pass, that change "survived", and your tests missed something. This makes it a very powerful extension to your vibe coding harness, next to code coverage. Coverage tells you which lines your tests run. Mutation testing tells you whether your tests actually check what those lines do.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.