What is difference between functional testing and non-functional testing?
Published: 2023-10-23 15:59:36

Functional testing and non-functional testing are very important part of STLC. Both focuses on different aspects of quality and performance for software product. Let's see the differences between these two types of testing.

**Functional Testing-** 
Functional testing validates the software against it functional requirements. It verifies and confirm if application behaves as expected and  meets the specified functional specifications.

See below for different types of functional testing with examples -

**_Integration Testing:_** Validates interactions between different modules.

_Example_: Integration Testing for E-Commerce website.
Test Scenario: Place a order on website.

Consider an e-commerce system with the following main components:

1. Shopping Cart
2. Payment Gateway
3. Order Management

Steps to place order - 

1. Add products to the Cart - Open the website url in browser and navigate to the product catalog. Select a product and add them to the shopping cart.

2. View Cart - Navigate to the shopping cart and verify the selected product is listed with correct price.

3. Proceed to Checkout - Checkout from cart and proceed to the payment page.

4. Make Payment -Make a payment using simulator/ payment gateway.

5. On processing payment, verify  the order details are correctly shown in the order management system.

Expected Results:
1.The shopping cart accurately displays the selected product and respective price.
2.The calculated total should match the sum of the product price.
3.The payment process should indicate a successful transaction.
4.The order details should be correctly recorded in the order management page.


**_System Testing_:** Validates the entire system end to end.
Acceptance Testing: Verifies if the software meets the requirements.

_Example_: Login and user profile management
Test Scenario: Login to website and update user profile information
Preconditions:

Steps:
1. User logs into website

2. Navigate to Profile Page

3. Click on the user profile link and access the profile page.

4. Edit profile information:

5. Update fields First name, Last name,  phone number, address.

6. Save the updates.

7. Verify updated information is shown on the profile page.


Expected Results:
1. The user is  able to access and edit their profile information.
2. The changes made are saved successfully.
3. The updated information is displayed on the profile page.



**Non-Functional Testing:**
Non-functional testing focuses on attributes like performance, security and usability. It checks how the system performs under specific conditions.

**_Load Testing_:** It evaluates how the system performs under expected load condition.

Example:
Example: Load Testing for e-commerce website during Diwali sale

Objective:
To identify how the e-commerce website handles traffic during Diwali sale.

Load Testing Steps:

1. Define test Scenarios: Simulate real user behavior during a sale event which includes
- Login into the website
- Browsing product pages
- Adding products to the cart
- Checkout from cart and place order

2. Identify Open source testing tool: Apache JMeter

3. Configure the number of virtual users: Specify the number of virtual users that will be part of load test. Start with 100 virtual users and gradually increase load up to 1000 users.
Simulate User Actions:

4. Develop different set of test scenarios with different user interactions on the website. 

- Login into website
- Browse products
- Search products
- Add products to the cart
- Place order
- Logout

5. Define ramp-up period for increasing load: Start with 20 users and increase by 20 every minute.

6. Execute the Load testing script using tool JMeter

7. During execution monitor key parameters:

- Response times for various pages 
- Transaction throughput (transactions per second)
- Error occurred percentage (Page not found, transaction failed, payment gateway timeout)

8. Analyze the test results: Review the reports and data generated by the load testing tool. It helps to find out performance bottlenecks/ issues.

Expected results:
1. The e-commerce website should provide reasonable response times during increased load.
2. End to end transactions should be completed without any errors or timeout.
3. The system should be able to handle the load without affecting the user experience.

_**Usability Testing:**_

Assesses the user-friendliness of the software. This involves evaluating how easily users can navigate, understand, and interact with the application.

_**Example**_ - Usability Testing for a Weather App
  To evaluate the user-friendliness of a weather application.

Usability Testing steps:
1. Check current location weather:
Users open the app and find the current weather conditions for current location.
2. View daily forecast:
User navigates to the daily forecast section and checks the weather predictions for the next day.

Expected Results:
End user is able to easily find and understand the weather information for their current location.
App's interface is intuitive, allowing users to navigate between different sections without any confusion.


**Conclusion** - Functional testing confirms that the software meets its defined functional requirements, while non-functional testing addresses quality attributes like performance, security, and usability. Using a combination of both testing methodologies, team can deliver high quality software product that meets user expectations.