Skip to main content

Fire Tower Tests & The GRIM Test.



Sometimes finding out why something is broken is a long and painful process. You might have to trawl through a tonne of data, logs or equipment. Filtering out what looks OK from what looks, suspect.

These laborious investigative tasks are in the back of our mind when we’re asked to do a code review, test some new code or a pull request.

What people often forget is that finding out if something is broken is completely different from finding out why it's broken. Being quick and efficient at finding broken stuff often takes a different approach to the task of clarifying the causes. A failure to test efficiently is therefore often a failure in imagination, a difficulty in creating these new techniques.



File:Kettlefoot Fire Lookout Tower atop Doe Mountain, Johnson County, Tennessee.jpg
Kettlefoot Fire Lookout Tower atop Doe Mountain, Johnson County, Tennessee

Take fire towers, for example, large forests in places like Canada and the US used to have large networks of Fire towers. These steel structures literally towered over the neighbouring landscape, providing a perfect vantage point for observers to spot and locate fires.

The towers made no attempt to diagnose the cause, monitor each tree, enforce bans on open fires or dictate how people used the forest. They just made it really easy to spot and locate smoke. 
They’ve taken the worst aspects of old scripted manual tests and shoehorned them into code. ...they made the movie just like the book, and it's painful to watch.
They did not catch every fire, but when they did see smoke people knew for sure that something was burning. That's something the local loggers and townspeople wanted to know about.

As software developers, we often get lost in the woods and try to check every tree for every kind of problem. Many teams take pride in the fact they can churn out large volumes of regression or integration tests for all their new features. 

For some, normal has come to be the writing out hundreds of (formerly manually executed) test cases in their chosen programming language. Automated, job-done, next ticket! They’ve taken the worst aspects of old scripted manual tests and shoehorned them into code. in doing so they made the movie just like the book, and it's painful to watch.

Another approach is to use software ‘fire tower’, relatively simple tests that can see that something is busted, at a glance. Like my Cribbage example in my last post, where it's quicker and simpler to scan over a large number of inputs checking for the wrong result than it is to exhaustively check each possible correct combination.

Another example is the GRIM test. Developed by academics Heathers & Brown, it's a quick and easy way to spot if some summary statistics are incorrect. The following video explains how it works:




In summary, it's a useful way to check if a mean and sample size is consistent. It will highlight if they are definitely wrong in some way, but it can’t tell you if it's correct. What's clever is that you don’t have to see the raw data. If you have a mean of 100 integers, you don’t need to know those 100 numbers to know if there might be a problem. Like the fire tower, it won’t catch every fire, but if it spots a problem then there's definitely a bug somewhere in there.

This could make your tests much quicker or allow them to work on existing data produced by other tests. For example, extracting data via a GUI can be slow. So we often have to simplify the tests to make them quick.

If instead of reading every raw data value to find the mean, you could check the average by using the sample size and the GRIM test. While you would still need to check that the results are generally correct, being able to check quickly if big data sets are broken could save you and your tests considerable time.

I’ve created a python package you can use to incorporate the GRIM test into your Python test code. It's capable of handling the full range of decimal rounding methods available in Python 3, and can even return a summary of which types of rounding deliver a consistent result.

Comments

Popular posts from this blog

Betting in Testing

“I’ve completed my testing of this feature, and I think it's ready to ship” “Are you willing to bet on that?” No, Don't worry, I’m not going to list various ways you could test the feature better or things you might have forgotten. Instead, I recommend you to ask yourself that question next time you believe you are finished.  Why? It might cause you to analyse your belief more critically. We arrive at a decision usually by means of a mixture of emotion, convention and reason. Considering the question of whether the feature and the app are good enough as a bet is likely to make you use a more evidence-based approach. Testing is gambling with your time to find information about the app. Why do I think I am done here? Would I bet money/reputation on it? I have a checklist stuck to one of my screens, that I read and contemplate when I get to this point. When you have considered the options, you may decide to check some more things or ship the app

Test Engineers, counsel for... all of the above!

Sometimes people discuss test engineers and QA as if they were a sort of police force, patrolling the streets of code looking for offences and offenders. While I can see the parallels, the investigation, checking the veracity of claims and a belief that we are making things safer. The simile soon falls down. But testers are not on the other side of the problem, we work alongside core developers, we often write code and follow all the same procedures (pull requests, planning, requirements analysis etc) they do. We also have the same goals, the delivery of working software that fulfills the team’s/company's goals and avoids harm. "A few good men" a great courtroom drama, all about finding the truth. Software quality, whatever that means for you and your company is helped by Test Engineers. Test Engineers approach the problem from another vantage point. We are the lawyers (& their investigators) in the court-room, sifting the evidence, questioning the facts and viewing t

XSS and Open Redirect on Telegraph.co.uk Authentication pages

I recently found a couple of security issues with the Telegraph.co.uk website. The site contained an Open redirect as well as an XSS vulnerability. These issues were in the authentication section of the website, https://auth.telegraph.co.uk/ . The flaws could provide an easy means to phish customer details and passwords from unsuspecting users. I informed the telegraph's technical management, as part of a responsible disclosure process. The telegraph management forwarded the issue report and thanked me the same day. (12th May 2014) The fix went live between the 11th and 14th of July, 2 months after the issue was reported. The details: The code served via auth.telegraph.co.uk appeared to have 2 vulnerabilities, an open redirect and a reflected Cross Site Scripting (XSS) vulnerability. Both types of vulnerabilty are in the OWASP Top 10 and can be used to manipulate and phish users of a website. As well has potentially hijack a user's session. Compromised URLs, that exp