Functional Testing Types: Unit Testing, Sanitary Testing, Smoke Testing, and More
Functional testing is defined as a type of software testing that tests the software’s functionality against functional requirements. What does that mean? Let’s start by understanding - what are functional requirements?
In the software development process, the requirements specification document lists all the business requirements. These requirements are further segregated as functional and non-functional requirements. Functional requirements specify what the system should do. Functional requirements are essential features of the product without which the system won’t work. Non-functional requirements specify how the system should perform the functions, i.e. they are the product characteristics that make it easy to use and ensure a better user experience. Even if these requirements aren’t met, the system will still work.
Let’s look at a few use cases where functional testing is used:
- Testing the login features against both valid and invalid inputs to make sure it works
- In a transaction processing system - testing that the payment gateway is working and notifying the user in case of a failed attempt
- In a file uploading feature - testing that if the size of the file exceeds the limit, it sends an error message
Types of Functional Testing
There are many different types of functional testing that are each fit for different use cases. You can choose a type to implement based on your use case.
What is Unit Testing?
The most common type of functional testing is unit testing. In unit testing, different components of the software/ source code are tested individually to validate they work as expected. This kind of testing is mostly for developers, but in some cases, QA engineers also perform unit tests. Unit tests can be manual, but are usually automated.
When should you run unit tests?
Unit testing highlights bugs in the initial development stages to save time and cost in later stages of development. Ideally unit tests should be done side by side with development. The purpose of unit tests is to fix bugs promptly rather than to run a complex workflow at the end to resolve multiple bugs. There’s no hard and fast rule you can decide for your team when to use unit tests and when to avoid them. However, they are recommended in the initial development phase. Whenever you are working on a new feature, you should run a unit test as well.
What is Smoke Testing?
Commonly known as build verification testing, smoke testing determines whether the deployed build is stable or not. If the build is stable, the QA team can continue with other types of testing. Smoke testing identifies issues in the early stages before testing starts and saves a lot of time and effort.
When should you run smoke tests?
Smoke tests are run when new features are added to the build. If the new build passes these tests, the testing process can continue.
What is Regression Testing?
Regression testing is a type of functional testing that takes place when changes are introduced in code, to ensure nothing has broken in other parts of the product.
Let’s discuss various types of regression testing techniques:
- Retest all - In this technique, all the tests are reexecuted to ensure that the system is bug-free. This technique is not used often as it’s time-consuming and needs more resources. In terms of cost, it’s an expensive method.
- Regression test selection - As the name suggests only a few tests are selected for regression testing. The selection of test cases is based on the module in which changes are made.
- Regression test prioritization - In this technique the tester identifies primary or most commonly used features and secondary or less used features in the product. Then, all the test cases are prioritized and test cases with high priority are taken up for regression testing. This saves time and human resources.
When should you run regression tests?
Regression tests are run when development is frozen and new improvements or changes are introduced in code.
What is Sanity Testing?
Sanity testing is defined as a subset of regression testing and takes place after it. Once all proposed code fixes are completed, sanity testing is done to ensure smooth performance and that the fixes ensure the products works as expected. If the sanity test fails, build is not triggered.
Suppose we have launched a clothing store application. A few days after our launch, users report that after adding items to the cart, the ‘Continue Shopping’ option is not working. This bug is taken up by the development team and they fix the code. This bug fix is then taken up by the testing team to run a sanity test. After a green flag from the testing team, a new build is triggered.
The main advantage of sanity testing is that it is a quick method, since there are no predefinec test cases or documentation. It is helpful in cases where bug fixes are required on an urgent basis.
When should you run sanity tests?
After regression testing is done and minor changes are introduced in the code. It is done before the build goes into production.
What is Integration Testing?
Integration testing is the process of testing all software components as a group after they are integrated. It’s a type of black-box testing, where testers interact with software and identify the breaking points between components. There are five commonly used approaches for integration testing:
- Big Bang Integration testing - performed after development is frozen and when the whole system is assembled.
- Top-down Integration testing - usually two or more modules are integrated from top to bottom and are tested.
- Bottom-up Integration testing - the opposite of Top-down integration testing
- Incremental Integration testing - modules that are logically connected are tested one by one.
- Hybrid Integration testing - combination of both top-down and bottom-up approaches. The interface and communication between modules are tested.
When should you run integration tests?
Integration testing is done after unit testing is complete. To ensure smooth running of the whole process it is advised to perform integration testing before moving on with other testing techniques.
Open Source Functional Testing Tools
There are plenty of available functional testing tools both paid and open source. In this article we have picked some of the most commonly used functional testing tools. Let’s discuss them one by one:
JUnit is an open-source testing framework for JAVA-based applications. JUnit provides unit testing capabilities for testing the code in small chunks. It is commonly used in test-driven development methods, where, unlike other tools, it helps in finding bugs in the early stages. Assertions and annotations are provided to locate the bugs and annotations tell the code what to do when code fails. JUnit5 is the latest release of JUnit.
Selenium provides a broad range of browser support including Mozilla Firefox, Google Chrome version 12.0.712.0 and above, Internet Explorer, Safari, Opera version 11.5 and above, and HtmlUnit version 2.9 and above.I also supports Windows, Mac OS, Linux, and Solaris operating systems.
BlazeMeter is a self-service testing platform as a service that supports open source tools. BlazeMeter provides a scalability feature and allows it to run tests on multiple engines. All the resources used for testing are available at an on-demand basis. It generates detailed reports of each testing session. All tests are stored in a repository and can be accessed at any time.
BlazeMeter can be used for API functional testing and GUI functional testing. In API functional testing, the backend of an application is tested by making calls to API endpoints and then various tests are run using customized parameters. GUI functional tests verifies the front end of applications like functionality of various buttons and inputs.
BlazeMeter provides an easy to use UI and it requires no installation. This saves time and efforts for the QA team. BlazeMeter is compatible with other testing tools like JMeter, Gatling, Selenium and Taurus. It is a cloud based solution so machine dependencies and resource allocation is not an issue.
Functional testing is an important part of the software development life cycle. It ensures a bug-free product as the test cases are based on real world use cases. Functional testing makes sure that all the product requirements are met and it enhances the quality of the product.
I hope this article will help you understand functional testing. To get started with BlazeMeter, sign up here.