Function testing – There’s more to it then you think!
I know. Function testing sounds easy. Probably the most common test technique and we have all done it in some way. So how much is there to learn, right?
As it turns out, quite a lot. As with any test technique you want to sharpen those skills to the max.
What is it
A function is anything that the product can do. In a software product there can be a lot of things happening at different levels. Some functions are hidden from view and can only be seen by looking at the code. Others might be clearly visible in a graphical interface or API.What functions and level of test that’s relevant for you depends on the project context. Function testing includes identifying relevant functions and to test them isolated.The major advantage of function testing is the focus and methodical testing of each function.
When to use it
In my experience, a good time to use more elaborate/methodical function testing technique is when there are changes being made that adds or changes functions in the system. The more functions, the more relevant.Personally, my focus on function testing tends to be strongest at the beginning of projects. It’s common that I make a model of functions early and then update it as the project goes on. A lot of times it’s the first thing I do after touring the product.
How-to: Identifying functions
We need to identify relevant functions. Relevant functions are functions that you believe you need to test in order to fulfil your test mission.If a specification exists, that can be a source to both identifying existing and not yet existing functions. As a consultant that works primarily in Agile projects, I find featuretours helpful in identifying relevant functions. A feature tour is an exploration of a product with the intent to identify and understand features. Play around with the functions. See what it can do and how it behaves. Remember, the goal is not to find bugs. Unless you observe a bug that you must report at once, make a note of it and look it up later or simply ignore it. Personally, I try to turn off my bug-hunting-observation-skills during tours.During your feature tour you are looking for functions, subfunctions and options. Subfunctions are related to the main function and adds value but they are not the primary feature. Options are variables that can be changed and alter the behaviour of the function.
Two common ways to document/model your findings are function lists and mind maps.
As an example, we shall take a look at gmail’s write-new-mail functionality
Going through the interface and applying a little bit of the CRUD (Create, Read, Update, Delete) heuristic on the mail draft entity, I came up with this function list. For the main function I believe that the number of different recipients will affect how the function behaves since it needs to send the email to more than one reciever. Also the attached entities and confidentiality option will alter how the function is sending its email.
The same list transformed into a mind map.
Remember, there’s no exact science to the modeling. No model will look exactly the same as another and that’s okay. The important thing is that it helps you structure your thoughts about your testing. I prefer the mind map model since I find it easier to see the structure of functions when it’s visual
A tip to beginners: Don’t try to make the perfect model since there never is one. Create a first version and update it later as you learn more about the product.
Each project is different, and it can be difficult to know how deep in the software you should go in identifying functions. In some you need to understand what’s going on under the hood. You need to look at code or ask the developers about the functions. What functions are there? What do they do? Is there variables or values that goes in or out of that function? How can they be controlled and observed?
In other projects what is presented in the GUI and API’s are a good enough level of detail.
How-to: Isolate functions
When you have identified interesting functions, it will be tempting to test the functions one after the other or together. That’s probably a great idea to do at some point but that’s not function testing. Function testing is focusing at one function at a time. Testing it with different options and observing outputs.So, you want to isolate and test each function separately. This can be hard since just getting to the function will probably require some steps. What’s important is that you do it the best you can under the given circumstances. So, if you have to create some entity, follow some steps to get to that function, that’s okay. Just try to keep everything to a minimum. Don’t use anything that’s not part of that function unless you have to. The reason for isolating the function, is that if you spot a possible problem you want to know that it’s the function in focus that’s causing it.
Operate/control
You have identified a function and you want to test it. The easiest place to start is the happy path. It is the normal intent of the function without any special options activated. So, you need to understand the purpose of the function. Then start analyzing the options. What options are there and how can they be combined?
An option is anything that makes the function do something different than its normal happy path. Combining options can also be seen as domain testing, another test technique.
Observation
You are not only looking for the direct output of a function. You have to observe the related behaviour of the system. When you start you will not know what can be affected so have your bug-hunting-observation turned on. Things that you don’t expect to be affected might be so don’t rule anything out.
When you are observing the functions behaviour you are looking for if the function does what it’s supposed to?
But also, does it do anything else that its not supposed to do?
Combining with other test technics
All test techniques works well with function testing and some are really hard not to include while function testing but if I would pick out a few that goes especially well it would be the domain and risk test techniques.
References and further reading
https://www.satisfice.com/download/heuristic-test-strategy-modelhttp://www.testingeducation.org/BBST/testdesign/https://www.developsense.com/articles/2006-07-TheFactorsOfFunctionTesting.pdf