Skip to main content

Scatter guns and muskets.


Many, Many years ago I worked at a startup called Lastminute.com (a European online travel company, back when a travel company didn't have to be online). For a while, I worked in what would now be described as a 'DevOps' team. A group of technical people with both programming and operational skills.

I was in a hybrid development/operations role, where I spent my time investigating and remedying production issues using my development, investigative and still nascent testing skills. It was a hectic job working long hours away from home. Finding myself overloaded with work, I quickly learned to be a little ruthless with my time when trying to figure out what was broken and what needed to be fixed.

One skill I picked up, was being able to distinguish whether I was researching a bug or trying to find a new bug. When researching, I would be changing one thing or removing something (etc) and seeing if that made the issue better or worse. When looking for bugs, I'd be casting the net wide, trying to catch as many issues as I could.

Nowadays, as a full-time tester, I use both skills every day. When I think I've uncovered a curious result or behaviour I switch to investigating mode to zoom in on prevalence, scope and causes etc. A good programmer will also usually have very good investigative skills which they put into practice when debugging and researching anomalies. 

Some people attempt to formalise what we (programmers, testers etc) do, by copying what people appear to be doing and putting that into a script. For example, some teams often take the 'change/try one thing' approach from research & investigation and try to use that -alone- for testing. They use a (BDD, Excel, Notepad etc) script that checks a calculation by calling the feature with example parameters, and checking the answer is correct. Great, Job done, green tick, the feature works, move on. (Ok, maybe not.)

Step 1: How might we improve on that?

That might be useful. But for just a couple more lines of code (basically just a for loop) you could check 100,000 parameters. This scattergun of data is much more likely to catch a bug. Why? Well, for example, there are usually rounding issues, hidden boundaries etc. From my experience there usually are issues, that won't come to light with just a token couple of example musket shots through the logic.

Picture of a Flintlock Musket called Brown Bess
Bess fired a lead bullet 1.9 cm in diameter, but could only fire every 20 seconds.

Step 2: Change of approach

We can use these same techniques and tools when testing in real time. We don't need to have a fully automated solution straight away. This gives us the ability to also find these issues up front, as we test. This isn't so much a technology change but rather, a change of mindset.

We can stop thinking of 'the tests' as being an immovable, unchangeable detector of 'goodness' (or not bad-ness for things we have checked) and instead think of them as a handy tool that I can grab anytime I need to dig deeper, get a clearer picture of whats going on. The 'tests' become something you use, a toolset, rather than something you build.

You will soon find your code is more generalised, more configurable and helps you find bugs - quicker.

Comments

Popular posts from this blog

The gamification of Software Testing

A while back, I sat in on a planning meeting. Many planning meetings slide awkwardly into a sort of ad-hoc technical analysis discussion, and this was no exception. With a little prompting, the team started to draw up what they wanted to build on a whiteboard.

The picture spoke its thousand words, and I could feel that the team now understood what needed to be done. The right questions were being asked, and initial development guesstimates were approaching common sense levels.

The discussion came around to testing, skipping over how they might test the feature, the team focused immediately on how long testing would take.

When probed as to how the testing would be performed? How we might find out what the team did wrong? Confused faces stared back at me. During our ensuing chat, I realised that they had been using BDD scenarios [only] as a metric of what testing needs to be done and when they are ready to ship. (Now I knew why I was hired to help)



There is nothing wrong with checking t…

A h̶i̶t̶c̶h̶h̶i̶k̶e̶r̶'s̶ software tester's guide to randomised testing - Part 1

Mostly Harmless, I've talked and written about randomisation as a technique in software testing several times over the last few years. It's great to see people's eyes light up when they grok the concept and its potential. 
The idea that they can create random test data on the fly and pour this into the app step back and see what happens is exciting to people looking to find new blockers on their apps path to reliability.
But it's not long before a cloud appears in their sunny demeanour and they start to conceive of the possible pitfalls. Here are a few tips on how to avert the common apparent blockers. (Part 1) Problem: I've created loads of random numbers as input data, but how will I know the answer the software returns, is correct? - Do I have to re-implement the whole app logic in my test code?
Do you remember going to the fun-fair as a kid? Or maybe you recall taking your kids now as an adult? If so then you no doubt are familiar with the height restriction -…

How did you find that bug? Are we sitting comfortably, then I'll begin.

How did you find that bug? - They asked with a sort of puzzled "he dun't thunk like uz" look on their faces. An expression that suggested they were unsure whether to commend the discovery or gather their pitchforks and organise a well overdue witch burning.

Likewise, I now knew why they needed me. The team members were genuinely hard working people trying to build something new and exciting. But they lacked one thing, someone exploring & asking questions - trying to find out new things about their application. Exploring is literally a step into the unknown, and that can be uncomfortable for those not experienced in how to do it well.
So how did I find that bug? It's easy to tell a story of how I tried that particular input value because... Paragraph 3 of v4.6 of the requirements document stated that the user shall indeed on occasion X given input Y in Chrome v62 do... Or spout some other overly verbose explanation of why that broken 'scenario' came to be…