QA Testing Guide for DeleteReportFunction

Overview

The DeleteReportFunction is an Azure Function that deletes a vessel report with specified report ID for a specific IMO (International Maritime Organization) number. It is exposed as an HTTP DELETE endpoint and supports various response scenarios based on the request and authorization.

# Endpoint Details

  • HTTP Method: DELETE

  • Route: /v1/vessel/report/{vesselImo}/{reportId}

  • Authorization: Bearer Token (JWT)

  • Path Parameter: vesselImo (required, string)

  • Path Parameter: reportId (required, string)

Test Scenarios

# 1. Valid Request

## Objective:

Verify that the function returns "202 Accepted" repsonse for a non-enpty IMO number, report ID and valid authorization token.

## Steps:

  • Send a DELETE request to /v1/vessel/report/{vesselImo}/{reportId} with:

  • A non-empty IMO number in the path.

  • A non-empty report ID in the path.

  • A valid Bearer token in the Authorization header.

  • Verify the response:

  • Status Code: 202 Accepted

  • Response Body: Empty.

## Expected Result:

The response indicates that the request was accepted for processing.

# 2. Empty IMO Number

## Objective:

Verify that the function handles empty IMO number gracefully.

## Steps:

  • Send a DELETE request to /v1/vessel/report/ /{reportId} with:

  • An empty IMO number in the path.

  • A non-empty report ID in the path.

  • 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 IMO number is missing.

# 3. Empty report ID

## Objective:

Verify that the function handles empty report ID gracefully.

## Steps:

  • Send a DELETE request to /v1/vessel/report/{vesselImo}/ with:

  • A non-empty IMO number in the path.

  • An empty report ID in the path.

  • 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 report ID is missing.

# 4. Unauthorized Request

## Objective:

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

## Steps:

  • Send a DELETE request to /v1/vessel/report/{vesselImo}/{reportId} with:

  • A non-empty IMO number in the path.

  • A non-empty report ID in the path.

  • 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

Test Case | IMO Number | Report ID | Authorization Token | Expected Status Code | Notes

Valid Request | 9795074 | 1234567 | Valid Token | 200 OK | Ensure the IMO exists.

Empty IMO Number | | 1234567 | Valid Token | 400 Bad Request | Test with empty IMO.

Empty Report ID | 9795074 | | Valid Token | 400 Bad Request | Test with empty Report ID.

Unauthorized Request | 9795074 | 1234567 | None/Invalid Token | 401 Unauthorized | Test with missing/invalid JWT.

Tools and Environment

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

  • Dependencies: Ensure all required services are functional.

Additional Notes

  • Validate the response schema for each test case 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.

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

  • The API sends VesselReport object to RMQ service bus.