# Testing
source: https://developer.mastercard.com/mastercard-send-avs/documentation/testing/index.md

## Sandbox Testing {#sandbox-testing}

Use this guidance to perform initial Sandbox testing for this API. It covers positive and negative coverage and test cases.

The Sandbox server returns simulated responses, enabling you to try this API quickly, and should not be used for full integration testing. For valid test card numbers that you can use in your requests, see [Sandbox Test Cards](https://developer.mastercard.com/mastercard-send/documentation/implementation/sandbox-test-cards/). Do not use real consumer card numbers in the Sandbox environment. When you are ready to test your integration, move to MTF, a production-like environment, to validate your integration before Production; see [MTF Testing](https://developer.mastercard.com/mastercard-send-avs/documentation/testing/index.md#mtf-testing).

### Choose a testing method {#choose-a-testing-method}

Choose a testing method that best matches how you want to validate requests:

* **[Postman Collection](https://developer.mastercard.com/mastercard-send-avs/documentation/developer-tools/postman-collection/index.md)** --- pre-built requests with OAuth configured.

<!-- -->

* Custom API client generated as per the guidance in [Generating and Configuring a Mastercard API Client](https://developer.mastercard.com/platform/documentation/developer-tools/generating-and-configuring-a-mastercard-api-client/).

### Positive testing {#positive-testing}

Positive testing confirms that valid requests succeed and return the expected data. Validate these behaviors:

* Valid request bodies return success code `200 OK`.
* The responses have the expected status values and response codes.

For test data and expected responses, see [Test cases](https://developer.mastercard.com/mastercard-send-avs/documentation/testing/index.md#test-cases).

The example below is a positive test case request body for a `POST /v1/partners/{partnerId}/accounts/account-verification` API call.
* JSON
* XML

```JSON
{
  "account_verification_input": {
    "account_verification_reference": "DEF123456",
    "account_uri": "pan:5102589999999913;exp=2077-08;cvc=123",
    "first_name": "John",
    "last_name": "Jones",
    "address": {
      "line1": "1 Main St",
      "line2": "Apartment 9",
      "city": "O'Fallon",
      "country_subdivision": "MO",
      "postal_code": "63368",
      "country": "USA"
    }
  }
}
```

```XML
<account_verification_input>
  <account_verification_reference>DEF123456</account_verification_reference>
  <account_uri>pan:5102589999999913;exp=2077-08;cvc=123</account_uri>
  <first_name>John</first_name>
  <last_name>Jones</last_name>
  <address>
    <line1>1 Main St</line1>
    <line2>Apartment 9</line2>
    <city>O'Fallon</city>
    <country_subdivision>MO</country_subdivision>
    <postal_code>63368</postal_code>
    <country>USA</country>
  </address>
</account_verification_input>
```

Expected result: `200 OK` and a response body containing status values of 'MATCHED'.

### Negative testing {#negative-testing}

Negative testing confirms that invalid requests fail cleanly and return useful error details. Validate these behaviors:

* Missing required fields return `400 Bad Request`.
* Invalid field values return validation errors with a clear `ReasonCode` and `Description`.
* Incorrect or missing authentication data is rejected.

For test data and expected responses, see [Test cases](https://developer.mastercard.com/mastercard-send-avs/documentation/testing/index.md#test-cases). For the error response message structure and a complete list of error codes and reason codes, see [Error Codes](https://developer.mastercard.com/mastercard-send-avs/documentation/code-and-formats/index.md#error-codes).

### Test cases {#test-cases}

Use the following test cases to produce specific responses. As long as the request message is properly formatted, a valid response will be returned.

|             Test Scenario             |                  Test Data                   | HTTP Status Code/Reason Code |                 Expected Result                  |
|---------------------------------------|----------------------------------------------|------------------------------|--------------------------------------------------|
| Address, postal code, and CVC matched | `account_uri` = pan:5204740000003362         | 200/OK                       | All status values MATCHED                        |
| Invalid value                         | `account_uri` = ABC                          | 400/INVALID_INPUT_VALUE      | Error: Invalid value (082000)                    |
| Invalid field length                  | `account_verification_reference` = 1         | 400/INVALID_INPUT_LENGTH     | Error: Invalid length (072000)                   |
| Invalid field format                  | `account_uri` = pan:ABC                      | 400/INVALID_INPUT_FORMAT     | Error: Value contains invalid character (062000) |
| Missing required field                | Omit a required field, such as `account_uri` | 400/MISSING_REQUIRED_INPUT   | Error: Value is required (092000)                |

## MTF Testing {#mtf-testing}

### Test Card Numbers and Associated Networks {#test-card-numbers-and-associated-networks}

For test card numbers that you can use for testing in the MTF environment, see [MTF Test Cards](https://developer.mastercard.com/mastercard-send/documentation/implementation/test-cards/).

Do not use consumer card numbers in the test environment.

### Sample Data {#sample-data}

|  Network   |                Name                |                    Account URI                     |                                                        Address                                                         |                          Response Status                          |
|------------|------------------------------------|----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| Visa       | first_name: Dicky, last_name: Bird | pan:4000289999999916;exp=2077-12;cvc=231           | line1: 1 Main Street, line2: Apartment 11, city: HAGEN, country_subdivision: MT, postal_code: 63368-3784, country: USA | address_status, postal_code_status and cvc_status will be MATCHED |
| Mastercard | first_name: Dicky, last_name: Bird | pan:{test-account};exp=2077-12;cvc=234 *See below* | line1: 1 Main Street, line2: Apartment 11, city: HAGEN, country_subdivision: MT, postal_code: 63368-3784, country: USA | *See below (Expected Results)*                                    |

For {test-account}, you can use the following Mastercard test account numbers to get success responses with different response values. Specify the account number in the Account URI field using the pan schema, for example `pan:5204740000004501;exp=2077-12;cvc=234`.

|                           Test Case                           |   Test Account   |                           Expected Results                            |
|---------------------------------------------------------------|------------------|-----------------------------------------------------------------------|
| Valid card and address with 9-digit postal code               | 5204740000004501 | All fields matched                                                    |
| Valid card and address with 5-digit postal code               | 5204740000004600 | All fields matched                                                    |
| Valid address and card with invalid CVC                       | 5204740000003362 | CVC not matched                                                       |
| Valid address and card with CVC not processed                 | 5204740000003370 | CVC not verified                                                      |
| Valid address and card with CVC issuer not certified          | 5204740000089056 | CVC not verified and the response description as issuer not certified |
| Valid card and address with invalid postal code               | 5204740000004311 | Postal code not matched                                               |
| Valid card with issuer not having any data                    | 5204740000004352 | Address and postal fields not verified, CVC matched                   |
| Valid card and address with invalid postal code and address   | 5204740000004337 | Postal code and address not matched                                   |
| Valid card with AVS not supported                             | 5204740000004394 | Postal code and address not verified                                  |
| Valid card and invalid address with valid 5-digit postal code | 5204740000004709 | Address not matched                                                   |
| Valid card and invalid address with valid 9-digit postal code | 5204740000004808 | Address not matched                                                   |
| Valid details, but system unable to process                   | 5204740000004378 | Address and postal code fields not verified and CVC matched           |
| Valid card without CVC                                        | 5204740000003370 | CVC not verified                                                      |

## Next Steps {#next-steps}

* Consult the [API Reference](https://developer.mastercard.com/mastercard-send-avs/documentation/api-reference/index.md) for complete endpoint specifications, request and response schemas, and environment URLs.
* If you run into issues, visit [Support](https://developer.mastercard.com/mastercard-send-avs/documentation/support/index.md) for FAQs and troubleshooting guidance.
