Product Allergens: Test Cases For Dietary Restrictions

Alex Johnson
-
Product Allergens: Test Cases For Dietary Restrictions

General Information

  • User Story: HU-C10
  • Description: Customers with dietary restrictions can view product allergens to avoid health risks.
  • Execution Date: November 14, 2025
  • Tester: Kevin Antonio Navarro Carrera
  • Methodology: Automated (Bash + curl)
  • Environment: Production Backend (https://back-dp2.onrender.com)

Executed Test Cases

TC-001: Obtain a List of System Allergens

  • Objective: Validate that the endpoint returns the complete catalog of available allergens.
  • Method: Automated bash script
  • Steps:
    1. Execute GET /api/v1/alergenos
    2. Validate HTTP 200 response
    3. Verify response structure with the items field
  • Expected Result: List of allergens with the correct structure.
  • Obtained Result: Catalog with 8 available allergens
  • Status: Pass

Allergen listings are crucial for users, especially those with dietary restrictions. This initial test case, TC-001, meticulously validates the system's capacity to provide a comprehensive list of allergens. The GET request to the /api/v1/alergenos endpoint is the first step in ensuring that the system can effectively communicate available allergen information. Achieving a HTTP 200 response is paramount, as it indicates successful communication between the client and server. Further, verifying the structure of the response by confirming the existence of the items field is equally important. This field serves as the container for allergen data. A correctly structured list of allergens confirms that the system is ready to move forward with additional testing. The expected outcome is that the list contains all available allergens in the correct format, allowing users to accurately assess potential risks. Ultimately, this test case sets the foundation for the entire testing process by establishing that the system can reliably deliver allergen information.

TC-002: Validate the Existence of Allergens in the Catalog

  • Objective: Confirm that the system has cataloged allergens.
  • Method: Automated bash script
  • Steps:
    1. Parse the response from the previous endpoint
    2. Count the elements in the items array
    3. Validate that count > 0
  • Expected Result: At least 1 allergen in the catalog
  • Obtained Result: 8 allergens cataloged
  • Status: Pass

The objective of test case TC-002 is to validate that the system indeed has cataloged allergens. Following the retrieval of the allergen list in the previous test, this step ensures that the list is not empty. To achieve this, an automated bash script parses the response from the /api/v1/alergenos endpoint and counts the number of elements within the items array. The critical validation step involves confirming that the count is greater than zero. In other words, there must be at least one allergen present in the catalog. The expected outcome is to find at least one allergen, and the obtained result shows that there are 8 allergens cataloged. Passing this test case verifies that the system not only provides a list of allergens but also that the list contains valid data. This is essential for customers who rely on accurate allergen information to make informed decisions. Validating the presence of allergens in the catalog ensures the system is not only functional but also provides meaningful and reliable information for users with dietary restrictions.

TC-003: Obtain Products with Allergens

  • Objective: Validate the endpoint that returns products with assigned allergens.
  • Method: Automated bash script
  • Steps:
    1. Execute GET /api/v1/productos/con-alergenos
    2. Validate HTTP 200 response
    3. Verify the structure with products and their allergens
  • Expected Result: List of products with allergen information
  • Obtained Result: 100 products returned correctly
  • Status: Pass

Moving beyond the simple listing of allergens, TC-003 examines how products are associated with allergens. This test case focuses on validating the endpoint that returns a list of products with assigned allergens. The automated bash script executes a GET request to the /api/v1/productos/con-alergenos endpoint. This endpoint should provide a list of products along with their corresponding allergens. Achieving a HTTP 200 response is crucial, confirming that the request was successful. Additionally, the test case verifies that the response structure includes products and their allergens. This ensures that the system delivers not just a list of products but also comprehensive allergen information for each item. The expected result is a list of products accompanied by their allergen details, allowing customers to identify potential risks. The obtained result shows that 100 products were returned correctly, which confirms that the endpoint is functioning as expected. By passing this test case, the system demonstrates its capability to provide meaningful and actionable allergen information for products, enabling informed decision-making for individuals with dietary restrictions.

TC-004: Validate the Structure of Products with Allergens

  • Objective: Confirm that the response structure is correct.
  • Method: Automated bash script
  • Steps:
    1. Parse the JSON response
    2. Validate that the items field exists
    3. Count the elements
  • Expected Result: Valid structure with items array
  • Obtained Result: 100 products with the correct structure
  • Status: Pass

Continuing from the previous test, TC-004 digs deeper into the structure of the response received from the /api/v1/productos/con-alergenos endpoint. The focus is on ensuring that the format of the data is as expected and usable. The automated bash script parses the JSON response and validates the existence of the items field. This field is essential as it encapsulates the list of products with their respective allergens. The script then counts the elements within the items array. This count provides a quick validation of the amount of data being returned. The expected result is to confirm that the response structure is valid and includes the items array. Additionally, the number of items should be reasonable, aligning with the expected dataset. The obtained result indicates that 100 products were returned with the correct structure, affirming that the endpoint is delivering data in the appropriate format. This test case ensures that the structure of the data is well-defined and consistent, enabling efficient data processing and presentation.

TC-005: Obtain Allergens for a Specific Product

  • Objective: Validate that allergens for an individual product can be queried.
  • Method: Automated bash script
  • Steps:
    1. Select a product from the list of products with allergens
    2. Execute GET /api/v1/productos/{id}/alergenos
    3. Validate HTTP 200
  • Expected Result: List of allergens for the product
  • Obtained Result: Product "Leche de Tigre" returns its allergens correctly
  • Status: Pass

Focusing on individual products, TC-005 validates the system's ability to retrieve allergens for a specific product. This test case ensures that users can drill down to see the allergens associated with a particular item. The automated bash script selects a product, in this case,

You may also like