Functional and Non functional testing
Published: 2024-06-13 15:13:56

Functional Testing
Objective: To verify that the software functions according to the specified requirements.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yxa0c92e5b2jhzu0siln.png)

Key Focus Areas:

Features and Functions: Ensures each feature works correctly.
User Interface: Verifies UI elements (buttons, links, forms) behave as expected.
API Testing: Confirms APIs return expected data and handle requests properly.
Database Testing: Checks data integrity and correctness of database operations.
Security Testing: Validates access controls and vulnerability issues.
Examples:

Login Functionality:

Test Case: Verify that a user can log in with valid credentials.
Expected Result: The user is redirected to the dashboard upon successful login.
Shopping Cart:

Test Case: Verify that items can be added to the cart.
Expected Result: Items are correctly displayed in the shopping cart with accurate pricing.
Form Submission:

Test Case: Verify that the contact form submits successfully with valid data.
Expected Result: The form displays a success message and the data is stored in the database.
API Endpoint:

Test Case: Verify that the /users endpoint returns a list of users.
Expected Result: The API returns a JSON array with user details.
Non-Functional Testing
Objective: To evaluate the performance, usability, reliability, and other non-functional aspects of the software.

Key Focus Areas:

Performance Testing: Measures response times, throughput, and resource usage.
Load Testing: Assesses how the system behaves under heavy loads.
Stress Testing: Tests the system’s robustness by pushing it to its limits.
Usability Testing: Evaluates how user-friendly and intuitive the interface is.
Reliability Testing: Ensures the system performs consistently over time.
Scalability Testing: Checks if the system can scale up or down effectively.
Compatibility Testing: Verifies the system's compatibility across different devices, browsers, and platforms.
Examples:

Response Time:

Test Case: Measure the time taken to load the homepage under normal load.
Expected Result: The homepage loads within 2 seconds.
Load Handling:

Test Case: Test the system with 10,000 concurrent users.
Expected Result: The system remains responsive, and the average response time does not exceed 5 seconds.
Stress Testing:

Test Case: Increase the load gradually until the system fails.
Expected Result: The system should fail gracefully and recover without data loss.
Usability:

Test Case: Evaluate the ease of navigating the website for first-time users.
Expected Result: Users should be able to navigate the site intuitively and complete key tasks without confusion.
Compatibility:

Test Case: Verify the application works on different browsers (Chrome, Firefox, Safari) and devices (desktop, tablet, mobile).
Expected Result: The application displays correctly and functions properly across all tested browsers and devices.
Summary of Differences
Purpose: Functional testing verifies what the system does (functional requirements), while non-functional testing verifies how well the system performs (performance, usability, etc.).
Requirements: Functional testing is based on user requirements and specifications. Non-functional testing is based on performance and operational criteria.
Execution: Functional tests involve verifying specific functions and features. Non-functional tests involve evaluating aspects like performance, load, and usability.
Outcome: Functional testing ensures functional correctness, while non-functional testing ensures performance, usability, reliability, and scalability.