Functional And Non-Functional Testing And Examples
Published: 2024-03-22 20:17:56

       _**Functional and Non-functional testing**_

**Functional Testing**
 Functional testing focuses on whether the software works intended that is whether it meets the functional requirements. It involves testing the features and functionalities of the software such as input/output, error handling and user interface.
 The primary goal of functional testing is to validate that each function of the application performs correctly according to the specified requirements. This type of testing focuses on user-friendliness and ensuring that the application meets the expectations of its intended users.
 To perform functional testing first we need to identify the test input and compute the expected outcomes with the selected test input values. Then we execute the test cases and compare the actual data to the expected result.
       **Types of functional testing**  
**1.Unit Testing**
     It involves testing individual units of code in isolation to verify their functionality. It is usually performed by developers during the development phase. The purpose of unit testing is to ensure that each unit of code functions as intended and meets the specified requirements. It helps identify defects early in the development cycle, promotes code reusability and provides a solid foundation for integration testing.
In unit testing test cases are created to validate the behavior of individual functions, methods. By testing units in isolation developer can easily identify and fix bugs making the code more reliable and maintainable.
**2.Unit Testing**
    Integration testing focuses on validating the interaction between different modules of the application. It ensures that the integrated parts work harmoniously and produce the expected output. Integration testing can be performed using various approaches.
Top Down Approach: Integration testing starts from the highest level components and gradually lower level components are integrated and tested. This approach allows early identification of integration issues.
Bottom Up Approach: Integration begins with lower level components and higher level components are gradually added and tested. This approach is useful when lower level components are more stable and critical to the applications functionality.
Hybrid Approach: This approach combines elements of both top down and bottom up approaches. It aims to achieve a balanced integration of components by identifying and addressing issues at different levels simultaneously.
Integration testing verifies that components can communicate and exchange data correctly, handles error carefully and maintain data integrity throughout the system. 
**3.Sanity Testing:**
  Sanity testing also known as smoke testing. It is a quickly evaluation of the applications major functionalities after making small changes. It's primary objective is to determine if the critical functions of the application are working as expected before proceeding with further testing.
  Sanity testing focuses on the most crucial features and functionality to ensure that the recent changes have not introduced any major issues. It is not an in depth test but rather than a superficial check to provide confidence that the  application is stable enough for further testing.
  By performing sanity testing teams can catch critical issues early and avoid wasting time on extensive testing if the applications fundamental functionality is compromised.
**4.Regression Testing:**
  Regression testing evolves the retesting the previously tested functionalities of the applications to ensure that any new changes have not caused existing  functionalities to fail. It aims to maintain the stability and integrity of the application.
 when new bugs fixes are introduced regression testing helps ensure that these changes do not impact the existing functionality of the application. It involves rerunning test cases that cover the affected areas to confirm that the system behaves as expected after modifications.
**5.System Testing:**
   System testing evaluates the entire system as a whole to verify its compliance with the specified requirements. It covers end to end scenarios including various functionalities and interaction between different components.
   System testing can be performed in both black box and white box testing approaches depending on the level of access to the systems internal workings. It test the system behavior, performance, security and other non functional aspects to ensure it meets the desired standards and user expectations.
  System testing typically involves creating comprehensive test cases that simulate real world scenarios and user interactions. It aims to identify any discrepancies between the expected and actual behavior of the system.
**6.Beta Testing:**
  Beta testing also known as user acceptance testing (UAT). It involves releasing the application to a limited set of end users its performance and gather feedback. It helps validate the applications usability, compatibility and overall user experience.
  During beta testing a real users test the application in a production like environment providing insights into its strength, weakness and  potential areas of improvement. Feedback collected during this phase helps identify bugs, usability issues and other areas of refinement.
Overall these functional testing plays an crucial roles in ensuring the quality, reliability and usability of software applications at various stages of the development process.

         **Non-Functional Testing**

 Non functional testing on the other hand is focused on testing the non functional aspects of the software such as performance, security, usability, reliability and compatibility. Non functional testing helps to ensure that software meets the quality standards and performs well under different conditions.
**Types of Non functional testing**
**1.Performance Testing:**
  Performance testing is crucial to ensure the smooth functioning of an application under expected workloads. Its primary objective is to identify performance related issues such as reliability and resource usage rather than focusing on finding bugs. When conducting performance testing it is essential to consider three key aspects such as quick response time, maximum user load, and stability across diverse environments.
   **1.1.Endurance Testing**- Endurance testing also known as soak testing verify the applications ability to handle sustained loads over an extended period. It aims to identify any performance degradation that may occur during continuous usage. By subjecting the application  to a prolonged workload, endurance testing helps ensure  that it can sustain high usage without issues such as memory leaks, performance degradation.
  **1.2.Scalability Testing** - Scalability testing measures how well the application can handle increased workload or user demand by adding more resources such as servers. It evaluates the applications ability to scale seamlessly as the user base grows. Scalability testing helps determine the systems capacity to handle additional load without significant performance degradation.
  **1.3.Load Testing** - Load testing evaluates the applications behavior and performance under expected and peak loads. It Involves simulating user interaction and subjecting the system to high concurrent user activity. The purpose is to determine the maximum capacity of the application and identify performance issues. Load testing helps ensure that the application can handle the anticipated user load without crashes and slowdowns.
**2.Usability Testing:** 
  Usability testing plays a critical role in identifying usability defects within an application. It involves a small group of users evaluating the applications usability, primarily during the initial phase of software development when the design is proposed. The focus is on assessing the ease of use and whether the system meets its intended objectives. usability testing can also be conducted on online android emulators for mobile applications.
Usability testing can be performed in a controlled  test environment with observers present. These observers closely monitor the testing process and create a comprehensive report based on users assigned tasks and their interactions with the application.
By conducting  usability testing using appropriate  methods and involving representative users organizations can give valuable insights into their applications usability, identify potential issues and make informed design decisions to enhance the overall user experience.
**3.Security Testing:**
  Security testing is an integral part of the mobile application testing process and holds utmost importance in ensuring app's resilience against external threats such as malware and viruses. It plays a critical role in identifying vulnerabilities and potential loopholes within the   application that could lead to data loss, financial damage or erosion of trust in the organization.    
 By conducting comprehensive security testing, organizations can strengthen the app's defense mitigate potential security risks and safeguard user data, revenue and the overall reputation of the organization. It is crucial to stay proactive in identifying and addressing security vulnerabilities to maintain a secure and trusted app environment.
**4.Compatibility Testing:**
  Compatibility testing ensures that the application functions correctly across different devices, operating systems, browsers and network environments. It helps guarantee a consistent user experience and broadens the applications reach to a wider audience. 
   It involves various verifying that the applications features, functionality and user interface are compatible with various platforms and configurations. By conducting compatibility testing developer can address issues  related to device specific behaviors, screen resolutions, browser compatibility and network compatibility.
**5.Accessibility Testing:**
  Accessibility testing verifies that the application is accessible to users with disabilities. It ensure compliance with accessibility standards and guidelines, marking the application usable for individuals with  visual and hearing. It involves evaluating factors such as screen read compatibility, keyboard navigation, color contrast  and alternative text for images.
   By conducting accessibility testing developer can ensure that their application is inclusive and can be accessed by a wider range of users, regardless of their abilities.

These different types of non functional testing are essential for ensuring that the application not only functions correctly but also meets performance, usability, compatibility and accessibility standards.



   _**Examples of Functional and Non Functional Testing**_

**1.Smoke Testing Example:**
  We have built an employee portal application for our client. As we follow continuous testing we had to test each build right after its development phase. The client wanted us to build the portal which consists of features like leave application, leave reports, store employees data and so on.
  First developer build a leave application feature and passed to QA for testing. The QA team examined that the entire build required 80-100 test cases for all the scenarios:
           Login
           Show total leaves count and types
           Testing of the calendar while selecting 
           the date
           Select date 
           User should be able to fill the 
           required information
           After applying request sent to the 
           manager for approval
           Manager approves the leave
           Employees get notified
           Leaves get deducted from the total 
           count 
           Logout

   Here smoke testing verified only critical functionalities which had only 20 test cases. These test cases covered the following scenarios:
           Login
           Select date
           Fill other details 
           Request sent to the manager after 
           clicking the button
  As you can see we have taken only the main features for testing which were crucial. For example if an employee can't select the date then there's no need for further testing. This saves the developers time of fixing bugs.
**2.Integration Testing:**
  lets take an example of search functionality in the e-commerce site where it shows the results based on the text entered by users. The complete search function works when developers build the following four modules.
Module#1: This is the search box visible to users  where they can enter text and click the search button.
Module#2: It is in simple terms program which converts entered text into xml.
Module#3: This is called engine module which sends  xml data to the database.
Module#4: Database
  
Module#1(search function)  <-->  Module#2(converter)  <--> Module#3(engine module)  <--> Database

In our scenario the data entered in the search function(module#1) gets converted into xml by module#2 gets converted into xml by module#2. The EN module(module#3) reads the resultant xml file generated by module2 and extracts the SQL from it and queries into the database. The EN module also receives the result set and coverts it into an xml file and returns it back to the UI module which converts the results in user readable form and displays it.

functional testing is a type of software testing that verifies that each function of the software application operates in conformance with the requirements. It primarily deals with testing the functionality of software by feeding input and examining the output. Here are some examples of functional testing scenarios across various types of software.

**1.Login Functionality Testing:**
  Verify that users can log in with valid credentials.
  Verify that users cannot log in with invalid credentials.
  Ensure that appropriate error message are displayed for invalid login attempts.
  Test the "Remember Me" functionality.
  Check if the "Forget Password" feature is working as expected.
**2.Search Functionality Testing:**
  Validate that the search functionality returns relevant results.
  Test search with various inputs, including valid , invalid, and partial keywords.
  Ensure that advanced search filters work correctly.
  Verify that infinite scroll works properly for large result sets.
**3.E-commerce Checkout Functionality Testing:**
  Test adding items to the shopping cart.
  Verify that users can proceed through the checkout process smoothly.
  Check for various payment methods and ensure they are functioning correctly.
  Test coupon code application and discounts.
  Validate order confirmation and email notification.
**4.User Profile Management Testing:**
  Test user registration with valid and invalid data.
  Verify that users can update their profile information.
  Ensure that users can change their password securely.
  Test profile picture upload functionality.
  Verify that users can delete their accounts if needed.
**5.File Upload Functionality Testing:**
  Test uploading various file types.
  Verify the maximum file size allowed.
  Test for uploading multiple files simultaneously.
  Ensure proper error handling for file format mismatches.
**6.Calculator Application Functionality Testing:**
   Verify basic arithmetic operations(addition, subtraction, multiplication and division).
   Test operations with different operand types(Integer, floating point).
   Validate memory functions(memory storage, memory call).
   Test edge cases such as dividing by zero.
**7.API Testing:**
  Verify that API endpoints return the expected response status codes.eg:-200 ok, 404 not found).
  Test input validation by sending request with invalid data.
  Validate response payloads for correctness and completeness.
  Test error handling by inducing errors in requests.eg:-missing parameters, invalid authentication).
  Check for rate limiting and throttling mechanisms.
**8.Email Functionality Testing:**
 verify that users can send emails successfully.
 Test email formatting(plain text, HTML).
 Validate email attachments.
 Check for proper handling of email bounce-backs and error messages.
 Test email notifications for various events.eg:-account creation, password retest.
**9.Calendar Functionality Testing:**
  Verify that users can create, edit and delete events.
  Test recurring event functionality(daily, weekly, monthly).
  Validate reminders and notifications for upcoming events.
 Check for Time zone  handling.
 Test integration with other calendar applications.
**10.Social Media Sharing Functionality Testing:**
   Test sharing content(text, images, links) on different social media platforms.
   Validate that shared content appears correctly on the social media platform.
   Test sharing from different different devices and browsers.
   Verify that privacy settings are respected when sharing content.
   Check for proper handling of authentication and authorization for sharing.
**11.Map and navigation Functionality Testing:**
   Verify that users can search for locations and get accurate results.
  Test route planning and navigation instructions.
  Validate map display and interaction(Zooming, panning).
  Test Integration with GPS services for real-time tracking.
  Check for alternate route suggestions and traffic updates.
**12.Chat Messaging Functionality Testing:**
  Verify that users can send and receive messages in real-time.
  Test group chat functionality.
  Validate message delivery status(read receipts, timestamps).
  Test media file sharing(images, videos, documents).
  Check for message encryption and security features.
**13.Online forms functionality testing:**
   Verify that users can fill out forms with various input types(text fields, dropdowns, radio buttons, checkboxes).
  Test form validation for mandatory fields and data formats.
  validate form submission and processing.
  Test error handling for invalid submissions.
  Check for auto save and draft functionality.
**14.Document Management System Functionality Testing:**
  Test document upload and download functionality.
  Verify document versioning and revision history.
  Test document search and filtering capabilities.
  Validate document sharing and access permissions.
  Check for integration with cloud storage services.
**15.Dashboard and reporting functionality testing:**
  Verify that data displayed on the dashboard is accurate and up to date.
  Test various filters and parameters for generating reports.
  Validate report export functionality(PDF, CSV, Excel).
  Check for drill-down capabilities in reports.
  Test dashboard customization options.
**Non-Functional Testing Examples:**
 Non Functional Testing also known as quality attribute testing, focuses on aspects of the software that are not related to specific functions. Instead it evaluates qualities such as performance, usability, reliability, security, and maintainability. Here are some examples of non functional testing scenarios:
**1.performance Testing:**
  Load Testing- Assess the systems behavior under normal and peak load conditions.
  Stress Testing- Determine the systems stability and responsiveness under extreme conditions beyond normal capacity.
  Volume Testing- Verify the systems ability to handle a large amount of data efficiently.
  Scalability Testing- Assess the systems ability to scale up or down with increasing or decreasing workload.
  Endurance Testing- Evaluate the systems performance over an extended period to identify any memory leaks.
**2.Usability Testing:**
  User Interface Testing(UI)- Evaluate the interface for ease of use, intuitiveness and consistency.
  Accessibility Testing- Access whether the application is accessible to users with disabilities, complying with accessibility standards.
 User Experience(UX) Testing- Measure user satisfaction by analyzing user interactions, feedback and overall experience.
**3.Reliability Testing:**
Availability testing- Assess the systems availability and uptime during normal operation and planned maintenance.
Fault Tolerance Testing- Verify the systems ability to remain operational in the event of hardware.
Recovery Testing- test the systems recovery mechanisms to ensure data integrity and continuity of service after failures.
**4.Security Testing:**
Vulnerability Assessment- Identify and mitigate security vulnerabilities such as injection attacks(SQL injection, XSS), authentication flaws and data breaches.
Penetration testing- simulate real world attacks to uncover potential security weaknesses and exploit them to assess the systems security posture.
Encryption Testing- verify the effectiveness of data encryption techniques in protecting sensitive information during transmission and storage.
Authorization Testing- Validate access controls to ensure that users can only perform authorized actions and access appropriate resources.
**5.Maintainability Testing:**
Code Quality Analysis- Evaluate code readability, maintainability and adherence to coding standards.
change Impact Analysis- Assess the impact of changes or update on the overall system stability and performance.
Documentation Review- Review system documentation(ex- design documents, user manuals) to ensure clarity, completeness and accuracy.
**6.Compatibility Testing:**
Browser Compatibility Testing- verify that the application functions correctly across different web browsers and versions.
Operating System Compatibility Testing- Ensure that the application is compatible with various operating systems(Windows, MacOS, Linux).
Device Compatibility Testing- Test the applications compatibility with different devices(desktops, laptops, tablets, smartphones) and screen sizes.
**7.Scalability Testing:**
Horizontal Scalability Testing- Assess the systems ability to handle increased load by adding more hardware resources(Scaling Out).
Vertical Scalability Testing- Evaluate the systems ability to handle increased load by upgrading existing hardware resources(Scaling up).
  
These examples illustrate various aspects of non-functional testing that are crucial for ensuring the overall quality and performance of software applications. Depending on the specific requirements and objectives of your project you can prioritize and conduct appropriate non-functional tests to address relevant quality attributes.