DEV Community

Jules Roadknight
Jules Roadknight

Posted on

Note to Self: The Tests are not to blame

I remember this place

The code works fine. Like, the program does what it's meant to, so why are the tests now acting up?

The heck is rspec?

I'd done a bit of programming before I started at a bootcamp last year, but testing was completely new. I remember talking to the rest of the cohort on Slack, and the general attitude was 'my program works, but these tests aren't passing'.

But soon

A week later, we were making our own tests, and everyone was suddenly very into testing. Very clearly useful, how were we ever programming without testing before now? Madness.

And then

Darn these tests, they're holding me back!

The point is

It's easy to slip into a mindset where tests appear to be working against me, despite the fact that I made these tests, so...am I the enemy?
Yes. Tests are also programs that can be filled with bugs, and if the 'real program' works but my tests don't, then the program doesn't work.

If nothing else, tests help you understand how a computer understands your program, so I have to consider how every change I make will be interpreted.

Iterate on code, and iterate on yourself.

Discussion (0)