Tom Ritchford
2 min readMay 31, 2021

--

What? No. I didn't say anything of the sort!

"Writing tests" means to me "writing computer code that automatically tests computer code" and I tried to make that clear.

As I did explain to you, in my experience QA is testing as if they were a user - that means using the program as if it were an end user. You might call this "black box testing". And yes, they are using some form of automation, no doubt.

""If I had to stop every time I needed a test" ... huh? What? Why should that be necessary, why would anyone work like that?"

It's like we're divided by a common language. Why would anyone work any other way?

I am right now working on a large information extraction system.

Today I'm going write some fairly tricky logic to classify data - one with a lot of edge cases. First, I'm going to write a few hundred lines of code, and then I'll immediately write a bunch of tests - first for the most common case, and then for edge cases, and I'll probably throw in some pathological cases too, just to try to break it and see how it performs, and for my own entertainment.

Only when I have those tests will I consider the code done.

The big advantage to how I work is that my code almost certainly works perfectly when I deliver it, and almost certainly continues to work perfectly through the life of the project.

I'm curious. How many times do you write a program, and then have it work perfectly the first time you run it, and continue to work perfectly forever?

This happens to me at least 20% of the time, and that's because just writing the tests while looking at the code finds a huge number of bugs, and by the time I am actually willing to run the tests, I have manicured the code.

Now, it's obviously silly to test every line of your code, because a lot of it has little chance of error.

But I literally can't imagine delivering code without automated tests, written by me, testing the most complex logic.

And the best part is that it takes me, in total, less time to write, because I spend very little time debugging and because with years of practice, I've gotten very fast.

You can see my code here: https://github.com/rec

Unfortunately, my most recent project is not open source, but it will give you an idea of where I'm at.

--

--

No responses yet