Tuesday 22 September 2015

InspirationGates - The Power of Automation

I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.
- Bill Gates

Day 2 of the morning shift, and it was much easier than day 1, because between me and the guy on the afternoon shift, we automated a lot of the tasks that need to be done. Perhaps that was management's secret goal all along. By giving us a crummy manual task, and telling us that we have to do this every day for a week, they knew we'd find a way to make it easier for ourselves. Automation is king!

So a bit of background for the non-software people (and to increase my word count to something other than the Bill Gates quote and the above paragraph), despite how much we work with computers, a lot of the things we do as part of our job used to be manual. I'll start with testing as it's a lot easier for me to explain. If you already understand automation, or have surmised the gist of this, you can skip the rest of this blog post, as it's written in an "Explain Like I'm 5" way.

This part is interactive!

Open up / turn on a calculator (it can be the one on your PC, or your phone, or even a super-dooper TI-1000000 graphics calculator, it just needs the basic arithmetic operations).

Type in 4 + 4 (and hit equals if your calculator requires that). Did you get 8 as an answer? Test passed!

Now try 3 + 7. Did you get 10?

0 + 0. Did you get 0?

If your calculator failed any of the above tests, I'd be worried.

Congratulations, you are now a tester! But that was the life of a manual tester. Someone would develop some software that performs addition, and it was the job of the tester to type in a bunch of different inputs, and check that the output is what was expected. It's not that basic, as they'll also do tricky things, like what if you hit plus twice in a row, or what if the sum was too big to fit on the screen, but that's the general gist of it.

Now your crazy cowboy developers have updated the application to also perform multiplication. So you need more tests:

3 x 5. Did you get 15?

4 x 0. Did you get 0?

1 x 19. Did you get 19?

All passed, time to go home!

Hold it!

You've proved that the multiplication works, but what you haven't done is proven that the addition function still works. So you also need to go back and perform the tests that you did before. Imagine how many tests you'll be running once the other functions get implemented: subtraction, division, sin, cos, tan, power, factorial, exponential, etc. Your fingers are going to get pretty sore pressing all those buttons. (You laugh at the idea of someone pressing buttons like that all day long, but I went to a talk given by some employees of a game development team I won't name, and they said one of their testers pretty much spends the first hour of his day playing through their game's tutorial. Every work day. They say he's gotten quite good at it, and can usually pick up when something is broken with the tutorial quite quickly.)

In comes the power of automation. If you could set something up to run all those tests for you, then all you'd need to do every time a new feature is added is update the list of tests, and then press a button to start the automation, and check the results at the end. (Astute readers might ask, "But if the testers are writing the automation framework, who tests their tests, and will those tests be automated, too?" Let's not go down that rabbit hole right now.)

Automation does come with a cost, as it may take time to set it up at the beginning, and so if you're just doing a two-hour throwaway thing, it might not be worth it, but seeing as the thing that I'm doing at work right now is probably going to be on-going, I'd definitely like to work more on automating it. One of the developers on my team wanted to get a T-shirt that said, "Go away, or I'll replace you with a really small shell script", and I feel like I am being replaced by some shell scripts now! Although I'm not worried about my job, it just means that I'm freeing myself from the more mundane tasks, and will have more time to do cool things!

No comments: