Okay, let's break down important test cases for integrating with NetSuite, using the SalesOrder entity as both the source (reading from NetSuite) and the target (writing to NetSuite). These tests should cover functionality, data integrity, error handling, and NetSuite-specific behavior.
I. Prerequisites & Setup:
- Environment: Ensure all testing is done in a dedicated NetSuite Sandbox environment. Never test integrations directly in Production initially.
- Test Data: Prepare comprehensive test data within the NetSuite Sandbox:
- Customers (various types, subsidiaries, currencies if applicable).
- Items (Inventory, Non-Inventory, Service, Kit/Package, Assembly - ensure some have inventory tracking, bin management, specific pricing levels).
- Locations (if used).
- Subsidiaries (if using OneWorld).
- Tax Codes/Groups.
- Shipping Methods.
- Payment Terms.
- Price Levels.
- Custom fields on Sales Orders (header and line level).
- Users/Roles with appropriate permissions for the integration.
II. Test Cases: NetSuite as SOURCE (Reading Sales Orders)
These tests verify that your integration correctly retrieves Sales Order data from NetSuite.
- Basic Retrieval:
- Retrieve by Internal ID: Fetch a specific Sales Order using its known NetSuite
internalId. Verify all expected fields are returned.
- Retrieve by External ID: Fetch a specific Sales Order using its
externalId (if used).
- Criteria-Based Retrieval (Search):
- By Status: Retrieve orders based on status (
Pending Approval, Pending Fulfillment, Billed, Closed, custom statuses). Test retrieving only orders in a specific status.
- By Date Range: Retrieve orders created or modified within a specific date range (
dateCreated, lastModifiedDate). Essential for delta loads.
- By Customer: Retrieve all orders for a specific customer.
- By Item: Retrieve all orders containing a specific item.
- By Custom Field: Retrieve orders based on the value of a custom header or line field.
- Combination Criteria: Retrieve orders matching multiple criteria (e.g., specific customer AND
Pending Fulfillment status AND within the last week).
- Data Content & Structure:
- All Field Types: Verify correct retrieval of standard fields (dates, numbers, strings, dropdown selections, checkboxes).
- Line Items: Retrieve orders with single and multiple line items. Verify all line item details (item ID, quantity, rate, amount, description, tax code, location, custom line fields) are retrieved correctly.
- Item Types: Retrieve orders containing various item types (Inventory, Non-Inventory, Service, Kit, Assembly) and verify associated data is correct.
- Custom Fields: Retrieve orders where header and line-level custom fields are populated. Verify their values.
- Addresses: Verify correct retrieval of shipping and billing addresses.
- Tax Details: Retrieve orders with different tax scenarios (taxable, non-taxable, specific tax codes/groups) and verify tax totals.
- Discounts: Retrieve orders with header-level and line-level discounts applied.
- Shipping Details: Retrieve orders with shipping costs and specific shipping methods.
- Currency: Retrieve orders in different currencies (if applicable) and verify amounts and currency codes.
- Subsidiary/Location: Verify correct retrieval of subsidiary and location information.
- Pagination/Volume:
- Large Result Sets: Test retrieving a large number of orders that exceed the page size limit of the API/search. Verify pagination logic works correctly to retrieve all records.
- Error Handling (Source):
- Invalid Credentials: Attempt retrieval with incorrect API credentials. Expect an authentication error.
- Insufficient Permissions: Attempt retrieval using credentials with inadequate permissions (e.g., role cannot view Sales Orders). Expect a permission error.
- Invalid Search Criteria: Use invalid field names or operators in search criteria. Expect a specific NetSuite error.
- Non-Existent Record: Attempt to retrieve a Sales Order by an
internalId or externalId that doesn't exist. Expect a "record not found" type response.
- NetSuite Downtime/Timeout: Simulate (if possible) or consider how the integration handles API timeouts or NetSuite unavailability during read operations.
III. Test Cases: NetSuite as TARGET (Creating/Updating Sales Orders)
These tests verify that your integration correctly creates or modifies Sales Order data in NetSuite.
- Basic Creation (Create):
- Minimum Required Fields: Create a Sales Order providing only the mandatory fields (typically Customer, Date, Item, Quantity, Rate/Price Level). Verify successful creation and default values applied by NetSuite.
- Full Field Population: Create a Sales Order populating all relevant standard fields (PO#, Memo, Ship Date, Terms, Ship Method, etc.). Verify all values are set correctly.
- Using Internal IDs: Create an order referencing Customer and Items using their NetSuite
internalId.
- Using External IDs: Create an order referencing Customer and Items using their
externalId (requires externalId to be unique and indexed in NetSuite).
- Data Content & Structure (Create):
- Line Items: Create orders with single and multiple line items. Include various item types. Verify quantities, rates, amounts, descriptions, tax codes, locations are set correctly.
- Custom Fields: Create orders setting values for header and line-level custom fields. Verify values.
- Addresses: Provide specific shipping and billing addresses during creation. Verify they override customer defaults if specified.
- Tax Details: Create orders specifying tax codes/groups. Verify NetSuite calculates taxes correctly based on rules.
- Discounts: Create orders applying header or line-level discounts (by linking to Discount items or using promotion codes if applicable).
- Shipping Details: Create orders specifying shipping method and cost.
- Currency: Create orders in specific currencies (if applicable). Verify amounts.
- Subsidiary/Location: Explicitly set subsidiary and location on the order/lines. Verify they are set correctly.
- Order Status: Create an order and verify its initial status (e.g.,
Pending Approval or Pending Fulfillment based on NetSuite settings/workflows).
- Updates (Modify existing Sales Orders):
- Update Header Fields: Modify fields like Memo, PO#, Ship Date on an existing order. Verify changes.
- Add Line Item: Add a new line item to an existing order. Verify totals and line count update.
- Update Line Item: Change quantity, rate, or description on an existing line item. Verify line and order totals update.