What is Functional Testing? Definition, Types & Examples
What is Functional Testing?
Functional testing is a type of testing where testers check if features of the System Under Test are working as expected according to its specified requirements. The primary goal of functional testing is to ensure that the software performs the functions it was assigned to do, and typically does not concern with the internal code structure or implementation details.
Functional testing can be considered as one of the most common and foundational types of testing. When people refer to "testing" in a general context, they often have functional testing in mind.
Examples of Functional Testing
1. Functional Testing For The Login Feature
Imagine you are testing a web application that requires users to log in. In this case, functional testing simply is used to check if the Login page is working as expected.
What are the “expected” features from a Login page then? Several that come to mind are:
- User Authentication
- Account Lockout
- Password Reset
- Remember Me
- Account Recovery
- Multi-Factor Authentication (especially critical for high-risk applications)
- Session Management (ensure that users are logged out automatically after a period of inactivity for security purposes)
- User Monitoring
Those requirements are agreed upon and carefully documented to guide the functional testing effort. Generally, the more emphasis placed on security, the more functional testing needs to be done for the Login feature. Here are several examples of functional test cases on the Login page:
- Test that users can successfully log in with valid credentials (e.g., a registered username/email and password).
- Test that users receive an error message when attempting to log in with invalid credentials (e.g., incorrect password or non-existent username).
- Test that after a specified number of consecutive failed login attempts, the account is locked and the user cannot log in.
- Test the password reset feature by initiating a password reset request through the "Forgot Password" link.
- Test the "Remember Me" feature to ensure that the user remains logged in across browser sessions.
- Test the implementation of MFA by logging in with valid credentials and verifying that the MFA method (e.g., SMS code, app-based token) works correctly.
Read More: 100 Test Cases For The Login Page
2. Functional Testing For eCommerce Websites
Similarly, we also need functional testing for eCommerce websites to check their specific features, such as Product Search functionality, Shopping Cart functionality, or even the Checkout process. Here are some examples of functional testing on those websites:
- Test that users can search for products using different search terms.
- Verify that the search results display the relevant products along with their prices, descriptions, and images.
- Verify that users can update quantities, remove items, and empty the cart as needed.
- Test the ability to add products to the shopping cart from product listings and product detail pages.
- Test the entire checkout process, including providing shipping information, selecting payment methods, and reviewing the order.
Functional vs Non-functional Testing: Key Differences
While indeed accounting for a major part of any test plan, functional testing should not be the only testing type your team performs. Non-functional testing is the much needed counterpart to functional testing, and it nicely covers what functional testing misses.
1. What is Non-functional Testing?
Non-functional testing is a type of software testing that focuses on evaluating the non-functional such as the system's performance, reliability, and stability.
Put simply, when doing functional testing, testers try to answer the question Can the system do what it was built to do?. When doing non-functional testing, testers try to answer the question Can the system do what it was built to do well enough?
Here are 5 non-functional test cases for you to better understand the concept:
- Measure the response time of the system under normal load conditions.
- Simulate concurrent user connections to determine how the system performs under heavy load, checking for response time degradation or failures.
- Conduct usability testing with actual users to gather feedback on navigation, intuitiveness, and overall user experience.
- Assess the system's ability to handle an increased workload by gradually increasing the load and observing performance metrics like CPU and memory usage.
- Test user roles and permissions to ensure that users can only access the features and data they are authorized for.
2. What are The Differences Between Functional and Non-functional Testing?
Functional testing primarily focuses on whether the system delivered the output desired. Non-functional testing validates the “hows” of the AUT’s features, performance, security, scalability, etc.
To verify if the software functions as intended and meets functional requirements.
To evaluate non-functional attributes like performance, security, usability, and more.
Tests what the software should do.
Tests how well the software performs certain functions or behaves under specific conditions.
Typically focuses on specific features or functionalities.
Covers a broader range of attributes beyond functionality.
Examples of Testing Types
Unit Testing, Integration Testing, System Testing, User Acceptance Testing.
Performance Testing, Security Testing, Usability Testing, Compatibility Testing.
Pass/fail criteria are often straightforward based on expected outcomes.
Pass/fail criteria may involve thresholds or benchmarks (e.g., response time should be below 2 seconds).
Ensures that the software meets user needs and expectations in terms of features.
Ensures that the software meets user needs and expectations in terms of performance, security, usability, etc.
Often involves binary outcomes (pass/fail) based on expected behavior.
Often involves quantitative measurements and benchmarks for non-functional attributes.
Tools and Technologies
Functional testing tools may include Selenium, JUnit, TestNG, etc.
Non-functional testing tools may include JMeter, OWASP ZAP, LoadRunner, etc.
Types Of Functional Testing and Examples
Functional testing is an activity that extends from component-level testing all the way to regression testing of existing features. Here is a list of common functional testing types and examples.
1. Unit testing
Unit testing is a type of functional testing executed by developers as they write code and build the application. The purpose of unit testing is to validate the functionality of a unit or component, making sure the desired outputs are generated given a set of inputs. As the most granular test, it sets up a solid foundation for more complicated, integrated, and comprehensive features.
Example: a restaurant needs an app that helps customers order at their tables without a server. The developer would create a unit test to examine the “add to order” function. Other individual functions such as “remove from order” or “submit order” would also go under unit testing.
2. Component testing (Module testing)
Component testing is similar to unit testing because they both isolate a single functionality and validate that individually. However, testing for components at this phase might call for stimulative interactions with sample test data, aka stub and driver.
Example: A healthcare service app has a functionality to help patients schedule to meet with medical professionals of their choice. The component to be tested is how the system displays the “nearby” hospitals or healthcare centers using data from the user’s GPS. To test for this function, the user’s profile is the stub and the driver is the available schedules from the health care provider.
3. Integration Testing
While modules and components can pass individually, quality engineers still need to ensure their functionalities as a group. Since a system’s modules and components are commonly built separately by different developers, integration testing is critical to validate that they work together correctly.
Modern software infrastructure often includes microservices that communicate with one another. These communications need to be included in integration testing and ensured that they operate properly.
Example: A banking app has a function where users can set up a saving account. It includes a money-transferring capability from their main account to the saving account. As they are separate modules, testers need to perform integration testing to ensure that the transactions happen smoothly and correctly between the two.
4. System testing
As the name suggests, in this phase, the software is tested as a complete, integrated system to verify that all business and functional requirements are met. Hence it is also referred to as end-to-end testing and often occurs right before User Acceptance Testing.
To yield correct validation, the test environment for system testing needs to be an accurate replication of the production environment. On top of that, it is performed in the white-box testing method, where testers have no involvement in the development of the system.
Example: a fitness app was created with capabilities such as setting up and tracking monthly fitness goals, consolidating fitness and wellness metrics, building personalized exercise sessions, and smart-watch integration,... Each of these functions will be assessed individually as well as all together in system testing.
The types of testing above can be distinguished by their level of granularity. For instance, if you are validating a webpage with the login function, this is how the level of granularity progresses:
- Unit test: validate the independent function of the login button
- Component test: validate the entire login page independently
- Integration test: validate the transition between the login page and other pages
- System test (end-to-end test): function of the entire webpage
Unit, component, integration and system tests are performed in multiple processes within the software testing life cycle, including regression testing, sanity testing, and smoke testing.
5. Regression testing
Any new change or feature added to the software can wreck its existing functionalities. Regression testing is performed every time alterations are made to check for the software’s stability and functionalities. Due to its work-intensive nature, regression testing is often automated.
Example: A food delivery app added a function to help users add multiple promotions on top of each other. A regression test needs to be done to make sure the checkout and payment process is not affected.
6. Sanity testing
Similar to regression testing, sanity testing is conducted for a new build with minor bug fixes, or new code added. If rejected in the sanity testing phase, the build will not proceed to further testing. While regression testing checks the entire system after alterations, sanity testing targets specific areas that are affected by the new code or bug fixes only.
Example: On an e-commerce webpage, users cannot add a particular product to their cart even when the stock is available. After the issue was fixed, sanity testing is performed to ensure that the “add to cart” function is indeed working.
7. Smoke testing
When a new build is completed, it is handed to the QAs for smoke testing. In this phase, only the most critical and core functionalities are tested to ensure that they yield the intended results. As an early-stage acceptance test, smoke testing adds a verification layer to determine whether or not the new build can proceed to the next stage or needs re-work.
Example: A utility company built an app with the function to report outages in customers’ homes. This function reports the address and other relevant information as well as notifies the homeowner when a dispatcher is on the way to help. Smoke testing will validate this feature on a fundamental level to assure that when an outage is reported, the correct information is sent so a dispatcher can be there on time.
How To Do Functional Testing?
Functional testing is standardly performed under this order of action.
1. Identify the function to be tested
Before testing, quality engineers must identify the function they want to test, its requirements, and how it should work. This step is essential for testers to learn the function’s purpose and how users would approach it. Only then can they effectively validate the function or find errors.
2. Create test scenarios
In a test scenario, testers describe an action that the user does and provide the desired outcome. For instance, a test scenario for a movie streaming service can be “test that users can add new movies to their “My favorite” list.”
3. Prepare test data and determine the correct outputs
Test data is created according to the scenarios and the requirements for the function. Testers will use this data to replicate the real-life usage of the system. Test data can either be input manually or through automation to shorten the time. Within this phase, the desired or acceptable output, as specified by the requirements, is also established.
4. Run test cases and validate the result against specifications
Depending on the type of test, they can be manually or automatically executed. For repetitive and time-consuming types, such as regression testing, it is best to automate them. After the test cases are performed, their outputs are compared against the requirements. If the output is not as expected, it is considered a defect.
Why Automate Functional Testing?
Software quality assurance is the final step before product release. Therefore, it is vital in terms of revenue and competitive advantage to speed up the process, yet the software quality must not be compromised. As the market constantly demands faster release of more complex software, test automation is the only way to maintain confidence in quality while satisfying the tight release schedule.
Read more: Automated vs. Manual Testing: When and Why?
Automation can also reduce the costs of errors significantly. Teams who adopt test automation can test earlier, fail faster, and is less likely to discover a bug when it is way too deep into the development process.
Test automation for functional testing increases productivity, collaboration, and visibility among stakeholders and quality engineers. By leveraging a software quality management platform that auto-generates reports, dashboards, and notifications and integrates with project management tools, all parties involved are informed about the product’s latest status, enabling fast and data-driven decision-making.
With repetitive and time-consuming test cases automated, quality engineers have more time to develop more insightful test scenarios, thoroughly test the product inside-out, and examine the product under edge cases and exploratory testing.
Functional testing plays a crucial role and is tied to many other activities in the software development life cycle. However, teams usually use a number of fragmented tools that solve separate testing needs, which creates a collection of complex, brittle, and hard-to-scale tool-stack for quality management.
In the long term, as products and teams scale, this approach will be the biggest hindrance to continuous growth and shortened time-to-market. The solution is a software quality management platform that assists in all testing activities, from planning, and testing to reporting and releasing.
How To Improve Your Functional Testing?
The Katalon Platform is an innovative and comprehensive end-to-end software quality management system that enhances collaboration, and management, helps teams scale, and continuously improves functional testing.
Katalon is an ideal choice for teams looking to avoid the complexities of creating their own testing infrastructure. It offers a comprehensive solution for testing professionals to evaluate the quality of web, mobile, and desktop software by allowing them to perform functional testing across environments within a single platform.
Katalon provides essential capabilities for planning, creating, executing, and analyzing automated functional tests. Some of its technical strengths include:
- Test Authoring Modes: Katalon offers various test authoring modes to cater to different team needs. It provides Record-and-playback for quick start or for those with limited technical expertise, along with a library of keywords for rapid test creation. For users seeking greater customization, there's a Java/Groovy scripting mode.
- Test Organization: All test objects captured during Record-and-Playback sessions are neatly organized in the Object Repository, facilitating easy access during test authoring. Test cases can be grouped into suites and collections and tagged for categorization.
- Test Execution: Katalon supports testing across a range of local and cloud browsers, devices, and operating systems, enabling the parallel execution of cross-platform API, end-to-end, and regression test suites.
- Easy Maintenance: An integrated object repository stores and manages UI elements, objects, and locators, simplifying test updates when the application's UI changes.
- Test Reporting and Analytics: After test runs, Katalon generates detailed reports in popular formats, facilitating easy sharing with team members and stakeholders. It also supports integration with communication technologies for improved collaboration.
Moreover, Katalon sets itself apart by incorporating cutting-edge, native AI features to enhance functional testing. Users can autonomously generate test scripts from plain language input or use the "Explain Code" feature to add comments to code snippets for better understanding among stakeholders and team members. Check out our pioneering AI features here.
Do your team need a better platform for functional testing? Claim your 30-day free trial now with the Katalon Platform.