Building on a Shaky Codebase

Yesterday I resolved to thoroughly test my current project before building any new features.

Figured the best place to start would be in a control flow library I wrote, which is used all over the API server. I use it to make complex processes manageable and readable.

upgrade-db-snippet

Comments are practically redundant because the name of each step explains what the snippet of code does.

I use the library all over the codebase, so it makes sense to thoroughly test it and proceed from there.

Imagine how humbled I was when it failed 20% of my tests.

test-stats

I may have gotten away with this for as long as I was the only person using it, but as soon as anyone else decided to use cjs-task, they had a 1 in 5 chance of having it fail them unexpectedly.

I’ve been building on a shaky codebase.

Time to pass all the tests. Then write some more.

Note to self: WRITE AUTOMATED TESTS, STUPID.

Get New Posts via Email

I don't always post, but when I do, you can get it sent directly to your inbox.

Join 8 other subscribers

  • Man thats the right thing to do, I pray for the grace to have the patience and clients to have the budget to pay for thorough testing. I think it is a habit that has to be consciously formed. I hope to get there one day

    • akamaozu

      The scary thing is that test code actually dwarfs the size of the actual code!

      I haven’t gotten to the stage of writing tests first, but I certainly appreciate the point of having them.