Skip to main content
Web Basics

Learn basics about web application testing

Yauheni Liashko avatar
Written by Yauheni Liashko
Updated over 2 weeks ago

Client-Server architecture

The Client-Server architecture is the backbone of how the web operates. It defines the interaction between two main entities: the Client and the Server. Let’s dive deeper into each component to understand their roles and how they work together to deliver web content to users.

SERVER

  • A server is a critical component of the web that provides services, processes requests, and sends responses back to clients. It can be understood in two ways: as software and as hardware.

    1. What is a Server?

      • As a Program (Web Server): A server is a program that uses the HTTP (Hypertext Transfer Protocol) to deliver web content (such as HTML, CSS, JavaScript, images, and videos) to clients. This program is often referred to as a web server.

      • As a Machine: A server can also refer to the physical or virtual machine on which the server program runs. These machines are typically powerful computers designed to handle multiple requests simultaneously.

    2. How Does a Server Work?

      • The server listens for incoming requests from clients (such as browsers) over the network.

      • It processes the request, which may involve retrieving data, running scripts, or performing other operations.

      • Once the request is processed, the server sends the results back to the client as a response.

    3. Key Characteristics of a Server:

      • Handles Multiple Clients: A single server can handle requests from multiple clients simultaneously, making it a shared resource.

      • Provides Resources and Services: Servers can deliver static content (e.g., HTML files) or dynamic content (e.g., data from a database, API responses).

    4. Examples of Servers:

      • Web Server: Delivers web pages (e.g., Apache, Nginx, Microsoft IIS).

      • Database Server: Stores and retrieves data (e.g., MySQL, PostgreSQL).

      • File Server: Manages and serves files (e.g., FTP servers).

CLIENT

  • A client is the entity that initiates communication with the server to request services or resources. It is typically the end-user's device or software application.

    1. What is a Client?

      • A client is any device or program that sends requests to a server. This could be a smartphone, a desktop computer, or even an IoT device.

      • The most common type of client is a web browser, but other examples include email clients and mobile apps.

    2. How Does a Client Work?

      • The client sends a request to the server, specifying the resource or service it needs (e.g., a web page, a file, or data).

      • Once the server responds, the client processes the response and presents the results to the user in a readable or usable format.

    3. Key Characteristics of a Client:

      • Request-Driven: The client always initiates the interaction by sending a request to the server.

      • User-Focused: The client is responsible for presenting the results (e.g., rendering a web page) in a way that the user can interact with.

    4. Examples of Client Programs:

      • Web Browser: Used to access websites (e.g., Google Chrome, Mozilla Firefox, Safari).

      • Email Client: Used to send and receive emails (e.g., Microsoft Outlook, Thunderbird).

      • Mobile Apps: Apps that interact with servers to fetch data or perform actions (e.g., social media apps).

How Client and Server Work Together

The interaction between the client and server can be summarized in the following steps:

  1. The user enters a URL (e.g., www.example.com) in the browser's address bar.

  2. The browser (client) sends an HTTP request to the web server hosting the website.

  3. The server processes the request and retrieves the necessary resources (e.g., HTML, CSS, images).

  4. The server sends an HTTP response containing the requested resources back to the browser.

  5. The browser renders the content and displays the web page to the user.

Types of validations

Validation is a crucial aspect of web applications, ensuring that user inputs meet the required criteria before processing. Validations can occur at two levels: Client-side and Server-side. Each type serves a specific purpose and has its own advantages and limitations.

Client-side validation enhances the user experience by providing immediate feedback directly in the browser. During client-side validation, all user inputs are checked and validated within the user's browser itself. This process eliminates the need for a round trip to the server, resulting in faster responses and reduced server load.

In server-side validation, the input submitted by the user is sent to the server, where it is validated using server-side scripting languages such as Java, ASP.NET, PHP, or others. After the validation process is completed on the server, feedback is sent back to the client, often in the form of a dynamically generated web page or a response message.

Key Differences Between Client-Side and Server-Side Validation

Aspect

Client-Side Validation

Server-Side Validation

Execution Location

Browser (user's device)

Server

Performance

Fast, reduces server load

Slower, requires server processing

Security

Less secure, can be bypassed

Highly secure, cannot be bypassed

Complexity

Suitable for simple checks

Handles complex logic and database lookups

Status codes and errors

When a web server processes an HTTP request, it responds with an HTTP status code. These three-digit codes indicate the result of the request and are grouped into five categories based on their first digit. Understanding these codes is essential for identifying and troubleshooting issues during software testing.

HTTP Status Code Categories

  1. 1xx: Informational
    Indicates that the request has been received and is being processed.
    Example: 100 Continue.

  2. 2xx: Success
    Confirms that the request was successfully received, understood, and processed.
    Example: 200 OK.

  3. 3xx: Redirection
    Indicates that further action is needed to complete the request, such as being redirected to another URL.
    Example: 301 Moved Permanently.

  4. 4xx: Client Error
    Indicates that the client (browser or user) made a mistake. Common causes include invalid requests or missing resources.
    Example: 404 Not Found.

  5. 5xx: Server Error
    Indicates that the server encountered an error or is unable to process the request.
    Example: 500 Internal Server Error.

4xx Client Error

  • The 4xx status codes occur when the client’s request has an issue. These errors are typically caused by problems such as invalid URLs, missing resources, or incorrect syntax in the request.

    1. Tracking Client Errors:

      • You can monitor client-side errors using the Developer Tools console built into every browser.

        • Press F12 (or right-click > Inspect) to open Developer Tools.

        • Navigate to the Console tab to view errors and warnings related to network requests, CSS, and JavaScript files.

      • Each error includes a description, the URL or file name where the error occurred, and, if applicable, the line and column number in the file.

    2. Common Example: 404 Not Found

      • The 404 Not Found status code means the client successfully connected to the server, but the requested resource (file or page) could not be found.

      • The error message typically includes the method (e.g., GET, POST) and the path to the resource that was not found.

5xx Server Error

  • The 5xx status codes occur when the server encounters an issue or is unable to perform the requested action. These errors are caused by problems on the server side, such as misconfigurations, server overload, or unhandled exceptions.

    1. Understanding Server Errors:

      • These errors indicate that the server is aware of the problem but cannot fulfill the request.

      • Common examples include:

        • 500 Internal Server Error: A generic error indicating that something went wrong on the server.

        • 503 Service Unavailable: The server is temporarily unavailable, often due to maintenance or overload.

Browser Cache, Cookies

Browser Cache

The browser cache is a temporary storage location for files like HTML, CSS, JavaScript, images, and multimedia content downloaded by your browser. It improves website performance by storing these files locally, reducing load times and server requests.

Key Points:

  • Benefits: Faster page loading and reduced bandwidth usage.

  • Issues: Outdated cached files can cause errors; clearing the cache can help resolve them.

Cookies

Cookies are small pieces of data stored on a user’s device by the browser. They enable websites to remember user-specific information for session management, personalization, and tracking.

Key Uses:

  • Session Management: Keeping users logged in or tracking shopping cart items.

  • Personalization: Storing preferences like language settings.

  • Tracking: Recording browsing activity for analytics or advertising.

Types: Session cookies (temporary), persistent cookies (long-term), and third-party cookies (external tracking).

Key Differences Between Cache and Cookies

Aspect

Browser Cache

Cookies

Purpose

Stores website resources to improve performance

Stores user-specific data for personalization

Data Stored

HTML, CSS, JavaScript, images, multimedia files

Small text-based data (e.g., session info)

Storage Duration

Until manually cleared or expired

Can be session-based or persistent

Size

Larger files

Small, typically a few kilobytes

Did this answer your question?