今日已更新 446 条资讯 | 累计 41220 条内容
关于我们

Testability Is a Feature. Does Your Code Agent Know About It?

Gil Zilberfeld 2026年09月09日 20:48 0 次阅读 来源:Dev.to

I always say that testability is a feature . It needs a customer – usually testers. We need to define what it means. And we need to build it in. The question is what happens to testability when someone else builds the code. Yup. Genie talk again. Let’s look at just 3 aspects of generated code, or any code really, that impact testability. But when our genie doesn’t get directions, it will skip those and cause us a big headache. 1. Complexity Of course, complexity affects testing. The more complex the code, the more work it takes to verify. More cases, more time – time that we don’t really have. My classic example is recursion. Recursion seems simple (in code lines), but it can hide all kinds of bugs in there. Edge cases galore. But that’s usually a function. That can be confined and handled. Today we’re generating systems. And they are as complex as the genie wants. Or the systems it was trained on. And those are not a model for simplicity. Complexity is the nemesis of testability. And unless we ask for simplicity, and make sure we got it, we pay for that in more expensive testing. 2. Observability Observability is a key part of testability. Without it, we may be able to operate the system, but may not see the impact of those operations. For example, if you had one POST API in the world that saves data in the database, and you want to check if it works, you’ll need to choose between looking inside the database (which may not be possible), or rely on the status code (which doesn’t tell you anything about the actual impact). Adding a GET to read helps, and presto – you’ve got observability. Of course, you need to ask for that GET API. In CRUD systems, you’d get that API, I’m not worried. Even in generated code. The problem starts with the not-so-intuitive stuff. What gets logged and where. Knowing how long it takes to see the result, and maybe how much time to wait between operations and states. The more the system exposes state and data, the easier it is to understand

本文内容来源于互联网,版权归原作者所有
查看原文