Introduction to functional testing
By: Jebali Wafa
Tags: User Testing, Functional Tests, Software Testing, Functional Testing, Regression Testing

1- What is functional testing ?

Functional testing is a test type that makes sure the software functions are performing the expected tasks. Here, “functions” are referring to what the software should do.

Mainly, I execute a set of steps with an input and conditions, then I check that the obtained result is as described in the functional requirements and specifications. This could also be called a behavior-based testing.

For greater understanding, let me illustrate with an example related to the connection feature of Facebook application.

In the specifications I have this functional requirement:

“As a user; when my device is connected to the network, my valid login and password are inserted in the corresponding fields of the connection page and then the “Log In” button is pressed, I want to be connected to my Facebook account and directed to the home page.”

Here, I can obviously see that the condition is that the device should be connected to the network. As to the inputs, clearly it is the valid credentials of the user account. Finally, the expected behavior is a successful connection to the Facebook account and a redirection to the home page (assuming we do not have Facebook server issues).

At this point, I can create a list of steps to execute in order to validate the connection functionality based on the requirement:

Given:

The user is on the connection page of Facebook application.

The device is connected to the network.

Action: Insert a valid login in the login field.

Result: The login field is populated.

Action: Insert a valid password in the password field.

Result: The password field is populated.

Action: Click on “Log In” button.

Expected result:

The connection to the user’s Facebook account is successful.

The user is redirected to Facebook home page.

After execution, if the obtained result is similar to the expected result, then the test is passed and the functionality is validated.

Before going any further, let me give you the right technical jargon so you can improve your knowledge about this topic.

The set of executed steps plus the input, the conditions and the output is called a “test case” aiming to validate a functionality or a behavior. Also, if you are not familiar with the term “functional requirement”, it means a description of the function that the software must offer. It could be called “functional specification” as well.

Now, I believe you have enough knowledge about what functional testing is, and I think it is time to dive deeper into this subject. So, if you are wondering why functional testing is important and how it can contribute to a product’s success, then congratulations, you are in the right place.

2- why should we care?

I am sure many of you heard of the Lion Air crash killing 189 people on October 29, 2018. Five months later, another 737 Max crashed in Ethiopia causing all 157 passengers on board to lose their lives.

Investigators identified issues with the system which was designed to help prevent stalls. It was triggered erroneously based on faulty data from a sensor, sending both planes into irrecoverable nose-dives leading to a crash.

Undeniably, the system had not been properly tested and deficiencies had not been detected before the production of the plane.

Following the two air disasters, the Max plane was grounded worldwide in March 2019 and Boeing company has suffered its first annual loss in more than two decades (losses estimated to 19B$ [https://www.bbc.com/news/business-50177788 ]).

Now, taking a much simpler example from our daily life, I will show you how testing is still fundamental.

For instance, Sephora is a company specialized in beauty products and its application keeps evolving. Every now and then, an update of the application is needed. The reason for that is there are new implemented functionalities or perhaps bug fixes which require a new release.

Behind each release, there is an entire development life cycle which includes a development phase followed by a testing phase. The development phase consists in making code modifications leading to either building a new functionality or fixing a bug. But code is never perfect. Let us imagine that the new developments have impacted the application behavior: when the user adds an article to the basket then access it, he finds it empty and as a result he is blocked, he cannot perform the main functionality offered by the application which is collecting his chosen articles in a basket so he can buy them.

At this point there are two possibilities. The first possibility is to neglect the testing phase and release the product. In this case, the end user will not be able to buy his products, he is unhappy, and he might buy them from other competitors with a possibility that the company loses them for life. The second possibility is to perform a test campaign to validate the new developments and verify there are no generated bugs or side effects. In this case, the version to release is functional, the user is satisfied, and the company is maintaining its clients and making profit.

To sum up, testing is important for both companies and customers as it ensures safety, protects, keeps clients, and saves money.

3- Types of testing:

In the previous example, I mentioned that a test campaign should be executed to validate the new developments and ensure that no bugs or side effects are introduced in the behavior of the application. Next, I will present two main types of functional testing.

A- Validation testing:

- Let us assume there is a defect on the version N of the software. This defect has been fixed by developers on version N+1.

At this stage, I should re-execute the exact steps on the new software version and I must have the expected result. All failing test cases because of this defect should be re-ran as well. If all tests are passed, then the fix is successful.

- During a project, some functionalities could be changed or updated based on a demand of customers or a change of vision. In addition to that, new functionalities could be added. Therefore, code modifications are required. In the testing phase, these implementations should be validated on the new version of the software.

According to ISTQB, confirmation testing is the validation of a bug fix. It can also be the validation of the implementation of a new functionality or a changing one.

B- Non-regression testing:

After code changes, the behavior of the software could be impacted. Hence, previously passed test cases need to be re-executed on the new version of the software to make sure its behavior is still as expected. Note that after each new delivery, a non-regression test campaign is needed to detect defects at the earliest.

I want to highlight that confirmation or validation testing and non-regression testing could also be called change-related testing.