In functional testing, we test software to ensure that it fulfills all functional requirements as specified in the business document. In this article, we learn about functional testing, why we should test the functionality of an application, the process of testing, types of testing, and some of the tools used for functional testing.
Table of contents.
- Why test?
- Functional testing process.
- Types of functional testing.
- Functional testing tools.
Functional testing involves testing the software to ensure it fulfills functional requirements and specifications. The software could be anything from websites, mobile applications, distributed systems, databases, operating systems, etc. We do this by providing the appropriate inputs and verifying the output against the functional requirements.
Functional requirements are specified in the initial stages of software development. This is where we define what the system is supposed to do, from the business's perspective.
In testing the functionality of a piece of software, we are not concerned with the source code. In fact, in black-box testing which is the common type of functional testing, the tester does not have a clue about the internal logic of the system.
In functional testing, we check software aspects such as; user interface, databases, security, APIs, client-server model, and much more.
This testing can be automated using tools such as JUnit, Selenium, or be done manually.
We test the functionalities of software for the following reasons:
- To make sure the application performs its main objective - mainline functions.
- To make sure the application is usable, in that, a user can use it without facing any difficulties - usability.
- To make sure the application is accessible by the user - accessibility.
- To make sure errors are handled appropriately by displaying them when error conditions are met - error conditions.
Other reasons to test applications are:
- It ensures that the application has no defects.
- Ensures the client is satisfied with the product.
- Ensures safety and security.
- Ensures product quality.
- Ensures that all business requirements are met.
Functional testing process.
We test an application's functionality using the following process.
- The first step before we test software is to understand its intended purpose by understanding its functional requirements.
- Next, we provide the appropriate inputs to the software. This should be per the functional requirements.
- With the provided inputs in the previous stage, we compute the expected outputs.
- Determine acceptable outputs as per the functional requirements.
- We then plan, design, and execute other test cases.
- We compare the computed results with the actual results to verify that the software is working correctly.
- Finally we manage defects in the software if any were encountered.
While testing applications, the following are best practices we need to uphold;
- First we need to select a dedicated automation team with specialized knowledge.
- Secondly, we need to select the right test cases, that is, we select test cases that don't need initial setup before execution. Here we implement tests prone to human error, testing in different operating systems, browsers, etc. Use a single test to test different data and finally run these tests repeatedly.
- Thirdly, we need to write automation tests that are reusable to run with different data sets. This enables us to make use of existing test scripts.
- We should also test frequently. This helps us identify more bugs.
- We should also check for breaks in the test, that is, the software might change, and if so we should also change the tests to avoid breaks.
Types of functional testing.
The following are types of functional testing;
- Unit testing - Here we test the software in pieces referred to as units. A developer can write scripts that test individual components of the whole application. Here we want to know if the component works as specified in the business document.
In unit testing code coverage is essential. Code coverage is the measurement of code run by unit tests, for example, if we have an application with two conditional branches a and b of code, a unit test that verifies a conditional branch a reports branch code coverage of 50%.
Integration testing - This type of testing ensures that individual software components work as expected when combined/integrated with other components.
Regression testing - Here we ensure that any changes to the code base don't affect the existing functionality of the application.
Usability testing - In this type of testing the clients test the application in a production environment. In this test, we gauge the comfort the user has with the application, here, we also gain useful insights which we use to improve the application.
Smoke testing - also referred to as build verification or build acceptance testing. It ensures that most essential functions of the application work as expected.
Sanity testing - After receiving the application build with minor changes, we ensure that all bugs have been fixed and no other issues have been introduced.
Black box testing - Also referred to as behavioral testing. Here the internal logic of the application is unknown to the tester.
White box testing - unlike black-box testing, the tester knows the code base of the application. Here the tester analyses the internal structure of the application.
Adhoc testing, here the application is tested with the goal of breaking it, It is unplanned and no test design is adhered to.
Database testing, here tests make sure that data is being stored, retrieved, and all other database activities are performed flawlessly.
Static testing, here we check for software defects without executing them. This is performed in the early stages and helps identify bugs.
Recovery testing, here testers try to know how well an application can recover from crashes such as hardware failure, network failure, etc.
Retesting, we retest an application to ensure that the previous bugs have been fixed.
Component testing, this is also referred to as module testing since we verify the working of individual components.
Grey box testing, this is a mix of black and white box testing. It is performed with limited knowledge of the system.
Production testing, this happens with real users after the application is launched. Here we want to identify as many issues as possible and fix them promptly.
System testing, once all modules have been integrated, this testing tests it to verify the correct functioning of the modules and components.
UI testing, here testers interact with the graphical user interface to ensure all buttons, menus, pages, text, etc have a positive impact on the user experience.
API testing, testers verify that all APIs are working as expected. This includes how they handle data and security.
Alpha testing, here the testers are internal members of the team. They have an idea about the project but are not directly involved with the application.
Beta testing, this testing is performed by a selected group of users. This is a soft launch which enables testers to get feedback from users without any prior knowledge of the system.
End-to-end testing, this is done after integration testing is complete. When all functional and non-functional requirements have been met.
Functional testing tools.
We can perform functional tests manually or by using automation tools. Automation reduces the time and effort we spend performing functional tests including reducing errors we might introduce. However, this means that we need to develop test cases for each case.
An automation tool must be easy to use, cross-platform, feature-specific to a team's requirements, and allow the reusability of test cases.
Commonly used functional testing automation tools are;
- Selenium - this is an open-source tool used for testing web and desktop applications.
- QTP(Quick test professional - This is an automated tool for functional testing. It is used for regression testing.
- JUnit - It is a unit testing framework for Java applications.
- SoapUI - This is another web application testing tool. It is also open source.
- Watir - this stands for web application testing in Ruby. It automates the browser and uses the Ruby programming language.
- Other functional testing tools are test complete, kobiton, testRigor, Real, Worry, Rapise, QA Wizard, test IO, Robots just to name a few.
We perform functional testing using the functional requirements provided by the client in the business document. These business requirements are the inputs we use to perform a functional test.
We test software to ensure safety, security, product quality, no bugs are present, usability, etc.
We use automation tools for functional testing such as JUnit, Watir, Kobiton, Rapise, Real, and OTP.
Types of functional testing are; unit testing, regression testing, integration testing, smoke testing, white and black box testing, user acceptance testing, and sanity testing.