January 7, 2022

Functional Testing Types: Unit Testing, Sanity Testing, Smoke Testing, and More

Functional Testing

There are many different functional testing types that are each fit for different use cases. You can choose a type to implement based on your use case.

This blog will explore the top 5 functional testing types, and dive into different open-source solutions that you can use to get started.

Table of Contents:

What is Functional Testing Used For?

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

What Are the Top 5 Functional Testing Types?

The five functional testing types we will explore today are:

  • Unit testing.
  • Smoke testing.
  • Regression testing.
  • Sanity testing.
  • Integration testing.

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.

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.

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:

  1. 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.
  2. 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.
  3. 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.

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.

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:

  1. Big Bang Integration testing - performed after development is frozen and when the whole system is assembled.
  2. Top-down Integration testing - usually two or more modules are integrated from top to bottom and are tested.
  3. Bottom-up Integration testing - the opposite of Top-down integration testing
  4. Incremental Integration testing - modules that are logically connected are tested one by one.
  5. 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

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

Selenium is a powerful open-source test automation tool. Developed in 2004, it’s been widely used to test web applications. The best thing about Selenium is that it supports a variety of programming languages like Python, Java, Javascript, C#, and others. This provides testers the advantage of running test scripts in a language they are already using and they don’t need to learn any specific language for this.

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

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 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.

Bottom Line

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.

Ready to try functional testing with BlazeMeter?

START TESTING NOW

 

Related Resources: