QA Testing Guide for GenerateStatementFunction

Overview

The GenerateStatementFunction is an Azure Function that retrieves vessels objects. It is exposed as an HTTP PUT endpoint and supports various response scenarios based on the request and authorization.

# Endpoint Details

  • HTTP Method: POST

  • Route: v1/odv/reports/api-generate-statement

  • Authorization: Bearer Token (JWT)

  • Body: A JSON object of type GenerateStatementRequest. The enpoint expects the fields imo required, from_date and to_date optional.

GenerateStatementRequest object example

{

    "imo": 9795074,

    "from_date": "2025-01-01T05:00:00",

    "to_date": "2025-11-01T05:00:00",

    "include_cii": true,

    "include_eu_ets": true,

    "use_fuel_eu_prioritization": true,

    "include_fuel_eu_ghg_intensity": true,

    "include_fuel_eu_compliance_balance": true,

    "include_fuel_eu_penalty": true

}

Test Scenarios

# 1. Valid Request

## Objective:

Verify that the function returns HTTP CODE 200 and PDF file.

## Steps:

  • Send a POST request to /v1/odv/reports/api-generate-statement with:

  • A JSON object in a request body.

  • A valid Bearer token in the Authorization header.

  • Verify the response:

  • Status Code: 200

  • Response Body: Generated statement as PDF file.

## Expected Result:

The response contains a confirmation that the request is accepted.

Test Data

{

    "imo": 9795074,

    "from_date": "2025-01-01T05:00:00",

    "to_date": "2025-11-01T05:00:00",

    "include_cii": true,

    "include_eu_ets": true,

    "use_fuel_eu_prioritization": true,

    "include_fuel_eu_ghg_intensity": true,

    "include_fuel_eu_compliance_balance": true,

    "include_fuel_eu_penalty": true

}

# 2. Invalid vessel IMO

## Objective:

Verify that the function handles non existant or assigned to another tenant vessel IMO gracefully.

## Steps:

  • Send a POST request to /v1/odv/reports/api-generate-statement with:

  • A JSON object in a request body.

  • A valid Bearer token in the Authorization header.

  • Verify the response:

  • Status Code: 400 Bad Request

  • Response Body: JSON object of type ErrorResponse with a description of the error.

## Expected Result:

The response indicates that the vessel with a provided IMO not found.

Test Data

{

    "imo": 1111111,

    "from_date": "2025-01-01T05:00:00",

    "to_date": "2025-11-01T05:00:00",

    "include_cii": true,

    "include_eu_ets": true,

    "use_fuel_eu_prioritization": true,

    "include_fuel_eu_ghg_intensity": true,

    "include_fuel_eu_compliance_balance": true,

    "include_fuel_eu_penalty": true

}

# 3. Unauthorized Request

## Objective:

Verify that the function rejects requests without a valid authorization token.

## Steps:

  • Send a POST request to /v1/odv/reports/api-generate-statement with:

  • No Authorization header or an invalid Bearer token.

  • Verify the response:

  • Status Code: 401 Unauthorized

  • Response Body: JSON object of type ErrorResponse with a description of the error.

## Expected Result:

The response indicates that the request is unauthorized.

Test Data

No Authorization header

Tools and Environment

  • Tools: Postman, OpenAPI UI, or any HTTP client.

  • Environment: CommonCore Stage https://apim-abs-cc-scus-stg.azure-api.net.

  • Dependencies: No dependencies.

Additional Notes

  • Validate the request schema for Valid Request to ensure it matches the expected type (GenerateStatementRequest).

  • Validate the response schema for unsuccessful test cases to ensure it matches the expected type (ErrorResponse).

  • Log any discrepancies or unexpected behavior for further investigation.

  • Ensure proper cleanup of test data after execution.

  • How to get token link.

  • Client ID, tenant ID, and secret for testing can be requested from the CC team.