Why Is It So Difficult To Get Started Writing Automated Tests?

I want to write automated tests. That's what a good developer does and dammit I'm a good developer.

But how?

I have an app. This app doesn't have any automated tests at the moment, and I'd like to write some. After all, testing is very obviously a Good ThingTM. So says everyone. It must be true.

I've tried Googling for "unit tests". Also tried "unit test examples" and all kinds of other permutations. They give examples, to be sure, but all the examples are so trivial as to be useless. None of that helps me know what I am supposed to do.

An illustration of man in a suit with a briefcase running around a track shaped like the infinity symbol

This app that I want to write tests for mostly does CRUD operations against stored procedures in a database. Do I test those CRUD operations? How? Am I even supposed to?

People always say, "tests are important. You must do them!" and then never tell me how to do them. Terms are bandied about like they're some miracle cure-all for my testing woes, and nobody can tell me in plain English what they mean. "Acceptance tests." "Mocking". "Units". They're all mumbo-jumbo to me.

WTF is unit testing anyway? What does it mean? How about integration testing? Acceptance testing? Why are there so many different kinds of testing? And what the fresh hell is mocking? When do I use it? Why do I use it? I have so many questions, and all my Googling does is give me inconsistent opinions and useless examples.

What am I supposed to do to write code that qualifies as a test? Does anybody know? Is there some unified testing ideology that other software developers are using and I'm just too stupid to figure it out? Or is it all just a bunch of black magic that only the privileged get to understand?

No wonder people complain about writing tests. The learning curve is tremendous.

I want to do automated testing! I do! And yet every time I try to get started, I run into these roadblocks. What are tests? What do they test? Why do we test these things? How do we select what things to test? I'm trying to be the self-driven learner and try something new and I'm getting thwarted at every turn. Why does this have to be so difficult?

I heard once that because debugging is twice as hard as coding, if you code something as cleverly as possible, you are by definition not smart enough to debug it. I'm starting to feel like this applies to writing automated tests as well.

At some point I'm sure I will just have to flip a coin and pick one. One testing scheme, one kind of test I want to write, something. Maybe after writing a few tests it will get easier. I can only hope.

I want to write automated tests. That's what a good developer does and dammit I'm a good developer.

But how?

RANT DISCLAIMER: This is not how I feel about testing in general, though it does concern me how difficult it is to get started with automated testing. I cannot believe that I am the only one ever to think that getting started with writing tests is terribly, unreasonably difficult. If you do too, hey, you're not alone. If not, tell me why I'm crazy in the comments.

Matthew Jones

Matthew Jones

I'm a parent, a husband, a geek, a web developer, and a speaker, in roughly that order.

Read More
Why Is It So Difficult To Get Started Writing Automated Tests?
Share this