Sobes.tech
Junior

What is non-functional testing?

sobes.tech AI

Answer from AI

Non-functional testing is a type of software testing aimed at verifying its non-functional requirements. It assesses system characteristics not directly related to specific functions, but rather how the system operates.

The main goals of non-functional testing:

  • To ensure that the system meets user and business expectations in terms of performance, reliability, usability, and other aspects.
  • To identify issues that may affect the stability, scalability, and security of the system.
  • To confirm the system's compliance with established standards and requirements.

Types of non-functional testing:

Test Type Brief Description Examples of Characteristics Checked
Performance Testing Evaluation of speed, responsiveness, stability, and scalability under load. Response time, throughput, CPU/memory load.
Load Testing Checking system behavior under expected peak load. Number of concurrent users, transactions per second.
Stress Testing Checking system behavior when exceeding expected peak load or resource shortages. System failure point, behavior under overload.
Endurance Testing Checking the system's ability to withstand prolonged continuous operation under load. Memory leaks, performance degradation over time.
Security Testing Checking system protection against external and internal threats, unauthorized access. Protection against SQL injections, XSS attacks, authentication, authorization.
Usability Testing Determining how easy and intuitive it is for users to use the system. Clear interface, easy navigation, accessibility.
Compatibility Testing Checking system operation across different environments (browsers, OS, devices). Support for various browser versions, OS.
Reliability Testing Assessing the system's ability to perform its functions without failures over a specified period. Mean Time Between Failures (MTBF), failure probability.
Accessibility Testing Checking the system's usability for people with disabilities. Compliance with WCAG standards.
Localization/Internationalization Testing Checking system adaptation to different languages and regional settings. Translated strings, date/number formats.

Non-functional testing is usually conducted at earlier stages of the software development lifecycle than functional testing, but its planning begins with requirements gathering. It can be part of automated processes, especially for performance and security testing.

Tools for non-functional testing:

  • Performance: JMeter, LoadRunner, Gatling, k6.
  • Security: OWASP ZAP, Burp Suite, Acunetix.
  • Compatibility: BrowserStack, Sauce Labs.
  • Usability: UserTesting.com, eye-tracking tools.

An example of automating part of non-functional testing could be a script to check page load time:

import time
import requests

def measure_page_load_time(url):
    """
    Measures the load time of the specified URL.
    """
    start_time = time.time()
    try:
        response = requests.get(url)
        response.raise_for_status()  # Raises HTTPError for bad responses (4xx or 5xx)
        end_time = time.time()
        load_time = end_time - start_time
        print(f"Page load time for {url}: {load_time:.2f} seconds")
        return load_time
    except requests.exceptions.RequestException as e:
        print(f"Error loading {url}: {e}")
        return None

# Usage example
url_to_test = "https://www.example.com"
measure_page_load_time(url_to_test)

Results of non-functional testing are often presented in reports, graphs, and metrics that allow evaluating system characteristics and making decisions about necessary improvements.