shooflenet/finalized/articles/dont_write_tests.html

24 lines
2.6 KiB
HTML
Raw Normal View History

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Writings by Shoofle</title>
<script src="/static/jquery.min.js" type="text/javascript"></script>
<link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link href="/static/shoofle.css" rel="stylesheet" type="text/css">
</head>
<body>
<article>
<h1 class="title">Stop Writing Tests.</h1>
<p>Okay, don't do that. Tests are great. But here's my rebuttal to the worship of test-driven development:</p>
<blockquote>Test-driven development doesn't work when you're designing the overall structure of your code.</blockquote>
<p>I'm specifically thinking about this in the context of knowing - knowing! - that test-driven development is the Right Thing, but not knowing how my application is even going to be structured in the first place. I can write basic tests for collision detection structures - and I did, although not by that name, and although they were terrible and missed a massive problem - but game development. How do I write tests for a system when every few commits is radically changing the structure? Tests work well when there's an easily verified success condition which stays consistent. Writing tests can interrupt the feedback loop that is useful for exploring new concepts and approaches!</p>
<p>But on the other hand, there's still a success condition there in something like a collision detection system. I could have written a test that adds a number of objects to a world in whatever collision structure I've chosen, and then tests manually to see if they're intersecting, and then sees if the structure reports the collisions correctly. In the end I actually <strong>did</strong> do that - it wasn't tremendously automated, but I made a thing that tested collisions (and reported the speed, mostly).</p>
<p>The place it falls apart is something like the component system. The point of tests is to see whether something is operating properly. But how do you check if something is operating properly, when "properly" changes from one version to the next?</p>
<p>The broader form of this is something like the physics code. One object bouncing off another has some broadly-defined "right-feeling" characteristics, but something like that is incredibly hard - impossible? - to write a programmatic test for. For one thing, testing of live behaviors is a pain. For another, you'd have to check programmatically if it feels right. If that's possible, then please, please tell me.</p>
</article>
</body>
</html>