The Basics of Functional Testing
Functional Testing often has a wide-ranging definition, encompassing several different practices and targets into one word. In the following guide, we’ll explore what we think is the heart of functional testing, and then expand outward.
Functional testing is a type of quality assurance practice where the outcome, given a certain set of inputs, is measured as true or false. While there are many flavors of functional testing that we’ll talk about below and several different test targets that can be validated functionally – it all comes down to a basic question of “does this action/event/workflow work correctly”.
Why is Functional Testing Important?
Functional testing is important because without it, you may not accurately understand whether your application functions as intended. An application may pass non-functional tests and otherwise perform well, but if it doesn’t deliver the key expected outputs to the end-user, the application cannot be considered working.
How Does Functional Testing Differ From Other Non-Functional Testing Types?
Functional tests verify whether specified functional requirements are met, where non-functional tests can be used to test non-functional things like performance, security, scalability or quality of the application. To put it another way, functional testing is concerned with if key functions are operating, and non-functional tests are more concerned with how the operations take place.
Examples of Functional Testing Types
There are many types of functional tests that you may want to complete as you test your application.
A few of the most common include:
Unit testing breaks down the desired outcome into individual units, allowing you to test whether a small number of inputs (sometimes just one) produce the desired output. Unit tests tend to be among the smallest tests to write and execute quickly, as each is designed to cover only a single section of code (a function, method, object, etc.) and verify its functionality.
Smoke testing is done to verify that the most critical parts of the application work as intended. It’s a first pass through the testing process, and is not intended to be exhaustive. Smoke tests ensure that the application is operational on a basic level. If it’s not, there’s no need to progress to more detailed testing, and the application can go right back to the development team for review.
Sanity testing is in some ways a cousin to smoke testing, as it is also intended to verify basic functionality and potentially avoid detailed testing of broken software. The difference is that sanity tests are done later in the process in order to test whether a new code change has had the desired effect. It is a “sanity check” on a specific change to determine if the new code roughly performs as expected.
Integration testing determines whether combinations of individual software modules function properly together. Individual modules may already have passed independent tests, but when they are dependent on other modules to operate successfully, this kind of testing is necessary to ensure that all parts work together as expected.
Regression testing makes sure that the addition of new code does not break existing functionalities. In other words, did your new code cause the quality of your application to “regress” or go backwards? Regression tests target the changes that were made and ensure the whole application continues to remain stable and function as expected.
User Acceptance Testing (UAT)/Beta Testing
Usability testing involves exposing your application to a limited group of real users in a production environment. The feedback from these live users – who have no prior experience with the application and may discover critical bugs that were unknown to internal teams – is used to make further changes to the application before a full launch.
UI/UX testing evaluates the graphical user interface of the application. The performance of UI components such as menus, buttons, text fields and more are verified to ensure that the user experience is ideal for the application’s users. UI/UX testing is also known as visual testing and can be manual or automated.
Other classifications of functional testing include black box testing, white box testing, component testing, API testing, system testing and production testing.
How to Perform Functional Testing
The essence of a functional test involves three steps:
- Determine the desired test input values
- Execute the tests
- Evaluate the resulting test output values
Essentially, when you executed a task with input (e.g.: enter an email address into a text field and click submit), did your application generate the expected output (e.g.: user is subscribed and thank you page is displayed)?
We can understand this further with a quick example.
A Functional Testing Example
Let’s begin with a straightforward application: a calculator.
To create a set of functional tests, you would need to:
- Evaluate all the possible inputs – such as numbers and mathematical symbols – and design assertions to test their functionality
- Execute the tests (either automated or manually)
- Ensure that the desired outputs are generated – e.g.: each mathematical function works as intended, the final result is given correctly in all cases, the formula history is displayed accurately, etc.
For more on how to create a functional test, you can see a full guide on how to write an automated functional test for this example.
Functional Testing Techniques
There are many functional testing techniques you might use to design a test suite for this:
- Boundary value tests evaluate what happens if inputs are received outside of specified limits – such as a user entering a number that was too large (if there is a specified limit) or attempting to enter non-numeric input
- Decision-based tests verify the results after a user decides to take an action, such as clearing the history
- User-based tests evaluate how components work together within an application – if the calculator’s history was stored in the cloud, this kind of test would verify that it did so successfully
- Ad-Hoc tests can be done at the end to try and discover bugs other methods did not uncover by seeking to break the application and check its response
Other common functional testing techniques include equivalence testing, alternate flow testing, positive testing and negative testing.
Automated Functional Testing vs Manual Functional Testing
Manual functional testing requires a developer or test engineer to design, create and execute every test by hand. It is flexible and can be powerful with the right team. However, as software grows in complexity and release windows get shorter, a purely manual testing strategy will face challenges keeping up a large degree of test coverage.
Automated functional testing automates many parts of the testing process, allowing tests to run continuously without human interaction – and with less chance for human error. Tests must still be designed and have their results evaluated by humans, but recent improvements in AI mean that with the right tool an increasing share of the load can be handled autonomously.
How to Choose an Automated Testing Tool?
Here are a few key considerations to keep in mind when choosing an automated testing tool:
- Ease of Use: Is it something easy for your existing QA team to use, or easy to hire for? Does it require an extensive learning curve or can it be picked up quickly?
- Flexibility: Can it be used across different platforms? Can it easily integrate with your current testing environment, and does it allow you the freedom to change your environment in the future?
- Reusability/AI Assistance: How easy is it to reuse tests, particularly if the UI changes? Is there meaningful AI that can help you test more efficiently, particularly at the scale you need?
- Support: What level of customer support do you require, and how easily can you receive it from the provider of your tool?
How to Use Automated Visual Testing for Functional Tests
One way to automate your functional tests is by using automated visual testing. Automated visual testing uses Visual AI to view software in the same way a human would, and can automatically highlight any unexpected differences with a high degree of accuracy.
Visual testing allows you to test for visual bugs, which are otherwise extremely challenging to uncover with traditional functional testing tools. For example, if an unrelated change caused a “submit” button to be shifted to the far right of a page and it could no longer be clicked by the user, but it was still technically on the page and using the correct identifier, it would pass a traditional functional test. Visual testing would catch this bug and ensure functionality is not broken by a visual regression.
Next steps with Functional Testing
Ready to take your functional game to the next level with Applitools? Here are a few resources to get you started on your automation journey.