Testing Commerce Connector Integrations

TABLE OF CONTENTS


Overview

  • Product: Znode 10 Commerce Connector
  • Audience: Partner and client integration developers, QA engineers, DevOps
  • Prerequisites: A non-production Znode 10 environment, a non-production ERP or PIM endpoint, Data Exchanges configured, and (for processors) the Custom API SDK with .NET 8

This article shows how to test an ERP or PIM integration built on the Znode 10 Commerce Connector before it touches production data. It covers non-production environments, sample payloads, manual runs, unit tests for custom processors, integration and end-to-end tests, volume and timeout tests, re-run (idempotency) tests, event and reconciliation tests, and a go-live checklist.

Use it as a test plan: each section says what to prove, how to prove it, and what evidence to keep.

What to Test and Why

A Commerce Connector integration has several layers, and each fails in a different way. Test each layer on its own first, then test them together.

LayerWhat can go wrongBest test
Mapping (YAML per step, Global Mapper)Wrong field names, formats, missing required columnsSample payloads and a manual run
Custom processor (C# in the Custom API)Logic errors, null handling, wrong countsUnit tests with a mocked client
Connectivity and credentialsWrong URL, expired token, firewallCredential Vault connectivity test, then a manual run
Whole flowRejected import rows, wrong data in ZnodeEnd-to-end test with a spot check in Admin and on the storefront
Scale and timeTimeouts, memory, overlapping runsVolume and timeout tests
Failure and repeatDuplicates, lost eventsRe-run and reconciliation tests

Commerce Connector has no built-in retry and no dead-letter queue for events. Your tests must therefore prove that a run is safe to repeat and that missed events are recovered. See “Commerce Connector Architecture and Processing Flow” for the seven processing flows (F1 to F7) and the run states used below, and “Mapping and Transforming Data in Commerce Connector” for mapping syntax.

The test pyramid below shows the three test levels for a Commerce Connector integration.


Test Environments

Never develop against production. Set up a non-production Znode 10 environment and point it at a non-production ERP or PIM.

Environment checklist

  • A Znode 10 non-production environment with its own Admin, Commerce Connector and Custom API.
  • A sandbox or test company in the ERP or PIM. If none exists, ask the system owner for one before you start; do not test against live data.
  • Credentials for the test systems stored in the Credential Vault, not in exchange definitions or source control. Run the connectivity test after each change.
  • A Custom API host that Znode can reach. For local debugging, point the Custom API Root URI (Global Settings) at a tunnel to your machine, then switch it back afterward.
  • Test data that includes edge cases: empty arrays, nulls, special characters, very long text, and records that should be rejected.

Important: Keep non-production and production settings separate. Use different Credential Vault values for each environment, and never copy production secrets into a test environment.

Keep exchanges disabled until tested

Only enabled exchanges run or can be scheduled. Build the exchange, test it with a manual run, and schedule it only after a successful result.

Sample Payloads and Mapping Validation

Mapping errors are a common cause of failed first runs, so validate them before the first scheduled run.

  1. Capture real samples. Save a response from every source endpoint, including edge cases. For event-driven exchanges, trigger a test event and save its Step 0 payload from the Dashboard step request; the event envelope carries EventName, EventModule, EventDataId, EventTimeStamp and EventPayload. Map from the captured payload.
  2. Keep samples in the repository next to the processor tests, with secrets and personal data removed.
  3. Run the mappingwith a manual run and compare the result with the expected output you wrote down in advance.

    , as {{Step1.OrderId}}. Event data in Step 0 is referenced as Step0.Payload.Field, and Credential Vault values as {{Var.NAME}} (plain values) or {{Secret.NAME}} (secrets).

  4. Compare row counts in and out. A difference means a filter or an import rejection.

Keep a small expected-output file for each sample. For a product import it can be a CSV:

SKUProductCodeProductNameWeightIsActive
LBL-1001LBL-1001Hazard label, 4x40.012true
LBL-1002LBL-1002Warning label, 2x20.008false

Use these rules when you check the output:

  • Map every required column of the import template; rows without them are rejected.
  • Send booleans as true or false and numbers without currency symbols or thousands separators.
  • Use the same SKU value on every import type so products, prices and inventory join.
  • Keep timestamps in UTC between systems.

Manual Runs

A manual Run of an enabled exchange in non-production is the main integration test. It exercises credentials, source call, mapping, destination and logging with real components.

Procedure

  1. Confirm credentials in the Credential Vault and run the connectivity test.
  2. Enable the exchange, then start a manual run. Do not schedule it yet.
  3. Open the Dashboard and the exchange History. Note the status (Succeeded or Failed), the counts and the log entry.
  4. Open the step-level request and response (Dashboard, or the Execution History tab for multi-step exchanges). Tokens are masked. Check headers, body and response for each step.
  5. For imports, open the Znode Import Log. It exists only when the Znode Import step succeeded. Read the row-level errors.
  6. Spot-check at least five records end to end in Znode Admin and on the storefront.

Important: Execution History is not available for exchanges that use a custom processor. Processors must log their own start, counts and result with the logId. Make that logging part of what you test.

Evidence to keep

Record the exchange code, run time, status, counts in and out, Import Log result and the five records you checked. This becomes the sign-off record for go-live.

Unit Testing Custom Processors (C#)

A custom processor is a class in Custom.Libraries.DataExchange with a constructor that takes IHandlerClient, IZnodeLogging, IServiceProvider and int logId, and a ProcessData() method that returns Task<dynamic>. See “Commerce Connector Architecture and Processing Flow” for the dispatch flow.

Because the client and logger are interfaces, you can test a processor with xUnit and a mocking library such as Moq or NSubstitute, with no network and no running Znode.

Design for testing

  • Put business rules in internal static methods or small services that take plain input and return plain output. These need no mocks.
  • Keep ProcessData() thin: call the input handler, call your transform, call the output handler, log the result.
  • Use InternalsVisibleTo so the test project can call internal methods.
  • Read configuration and secrets through injected settings, never from static fields.

Test the transform and the processor

public class NormalizeProductFeedTests
{
 // 1. Pure transform: no mocks, captured sample as input.
 [Fact]
 public void Transform_drops_blocked_items_and_converts_weight()
 {
 var csv = "SKU,Name,UOM,WeightG,Blocked\nlbl-1, Label ,EA,12,false\nlbl-2,Old,EA,5,true";
 var result = NormalizeProductFeed.Transform(csv).Split('\n');
 Assert.Equal(2, result.Length); // header + 1 row
 Assert.StartsWith("LBL-1,", result[1]);
 }
 // 2. Processor: mock the clients, check what it sends and logs.
 [Fact]
 public async Task ProcessData_returns_false_and_skips_output_when_input_is_empty()
 {
 var client = new Mock<IHandlerClient>();
 var log = new Mock<IZnodeLogging>();
 var sp = new Mock<IServiceProvider>();
 // Shape the mocked input handler result to match your SDK package version.
 client.Setup(c => c.PostInputHandlerAsync(It.IsAny<HandlerRequestModel>()))
 .ReturnsAsync(new StringResponse { Response = "[]" });
 var processor = new NormalizeProductFeed(client.Object, log.Object, sp.Object, 42);
 var result = await processor.ProcessData();
 Assert.False((bool)result);
 client.Verify(c => c.PostOutputHandlerAsync(It.IsAny<HandlerRequestModel>()), Times.Never);
 }
}

Tip: IHandlerClient exposes Task<StringResponse> PostInputHandlerAsync(HandlerRequestModel body) and Task<StringResponse> PostOutputHandlerAsync(HandlerRequestModel body), each with an overload that takes a CancellationToken. StringResponse has one property, string Response, so a mocked result is new StringResponse { Response = "<json>" }.

What to cover

  • Input handler returns nothing: the processor returns false and does not call the output handler.
  • Output handler returns nothing: the processor reports failure.
  • Every request carries the logId passed to the constructor and the exchange code you expect.
  • Log messages for start, counts and result are written, and failures log at warning or error level.
  • Empty, null, duplicate and malformed records in the transform.
  • Background (fire-and-report) processors: a second call while a run is active returns false, and the final status is reported exactly once with totals, not increments.

Run these tests in your CI pipeline on every change, before the Znode CLI deploys the Custom API.

Integration and End-to-End Tests

Unit tests prove your code. Integration tests prove the contract with the systems around it.

Integration tests

  • Typed client against a sandbox. Call the ERP sandbox with your typed HttpClient and check authentication, paging, error codes and field names. Mark these tests so CI can skip them when the sandbox is unavailable.
  • Custom API endpoint. Commerce Connector calls custom-data-exchange/execute-data-exchange with an erpId and a logId. Call it on a non-production Custom API and check the response: the SDK returns 200 with the processor result, or 204 when the result is empty.
  • Processor File Name. The Processor File Name in Admin must match the class name exactly. Trigger every processor's exchange once.

End-to-end tests

The diagram below shows the end-to-end test flow from the ERP sandbox through Commerce Connector to Znode.


For each flow type you use, write one end-to-end case:

  1. Scheduled import: seed a known record, run, then verify the record in Admin and on the storefront.
  2. Event-driven exchange: trigger the Znode event (for example, create an account), then verify the ERP record and any write-back to Znode.
  3. Callback (live price or inventory): load a product page or cart and verify the value. Then disable the callback exchange and confirm that Znode falls back to its stored values.
  4. Inbound webhook into the Custom API: send a valid, an invalid-secret and a duplicate notification, and verify the response codes and that only the affected record is synced.

Volume and Timeout Tests

Do not assume that a test with ten records predicts a run with 500,000.

  • Use production-sized data in non-production, masked or synthetic.
  • Page and batch. Page size guidance is 200 to 1,000 records (maximum 5,000). Keep files under 50 MB. There is no built-in cap on records per run, so protect memory by batching inside processors.
  • Know the shortest timeout. The exchange Timeout (seconds), the gateway and the load balancer each can end a run. The shortest one wins, and the run is marked Failed even if work continues downstream. Set the exchange timeout below the gateway and load balancer timeouts.
  • Test the background pattern for long jobs: the processor returns at once, then reports the final status once through the process-log API. Verify that the run leaves the Started state and shows the right counts.
  • Callbacks: measure against the budget of about 2 seconds response, under 1 MB payload, ERP latency under 500 ms and under 20 concurrent calls. There is no built-in rate limiting, so test concurrency yourself.
  • Overlap: only one processor execution runs at a time per Custom API instance. Test that a second trigger during a running job is skipped, and stagger schedules so heavy jobs do not overlap. Avoid intervals under five minutes.

Tip: Record the run time and peak memory of your largest test run. Set the schedule interval and exchange timeout from that measurement, with headroom.

Re-Run and Idempotency Tests

Commerce Connector has no built-in retry, so a person or a schedule will eventually repeat a run, and a failed run will be restarted. Every run must be safe to repeat.

TestHowExpected result
Run twice with the same dataManual run, then run again without changesNo duplicate products, prices, accounts or orders
Interrupted runBreak the ERP connection or credentials mid-run, fix it, run againThe second run completes the remaining work and no record is half-written
Overlapping runsTrigger a second run while the first is activeThe second run is skipped or rejected
Delta watermarkFail a run, then rerunThe watermark did not advance after the failure, so no changes are skipped
Final status reported onceCheck the process log of a background runOne final status call per run, with totals as counts

To make these tests pass, use a stable business key (such as SKU or the ERP customer number) as the match key, write by key rather than append, and advance the delta watermark only after success.

Event and Reconciliation Tests

Events can be lost if the runtime restarts, and there is no dead-letter queue. Pair every event-driven exchange with a scheduled reconciliation, and test both.

Event tests

  • Trigger each subscribed event and confirm that every enabled exchange subscribed to it starts.
  • Check that Step 0 holds the read-only event payload and that later steps read values from it.
  • Confirm that a failed step shows on the Dashboard and in notification emails.

Reconciliation tests

  1. Create a change in the source system while the event is switched off, or drop the event on purpose.
  2. Run the scheduled reconciliation exchange.
  3. Confirm that the missed record is found and processed, and that records already in sync are not changed.
  4. Compare counts and spot-check records on both sides. Keep the comparison as a repeatable report.

A common pattern is a delta exchange on a watermark with a weekly full reconciliation, for example 0 3 * * 0 (03:00 every Sunday).

Hand-off Checklist

Complete these in non-production and keep the evidence.

Go-live checks:

  • Credentials are in the Credential Vault, the connectivity test passes, and no secrets are in source control.
  • ured sample payloads, including edge cases.
  • A manual run succeeded, and History, Dashboard step data and the Import Log were reviewed.
  • At least five records were spot-checked in Admin and on the storefront.
  • Unit tests pass in CI for every processor and transform.
  • Each processor was triggered once through its exchange, and logging with the logId was confirmed.
  • Volumes were tested with production-sized data. Run time is within the shortest timeout, or the background pattern is in place.
  • The re-run test passed: no duplicates, and the watermark behaves correctly.
  • The overlap guard was tested: one run per sync at a time.
  • Event-driven flows were tested, and a scheduled reconciliation recovered a missed event.
  • Callbacks are within the latency budget, and the fallback to stored values was confirmed.
  • Notification emails reach the right recipients.
  • The Custom API is deployed with the Znode CLI from CI, and the Custom API Root URI points to the real host, not a tunnel.
  • The exchange is enabled and scheduled in production only after the checks above, and the first production run is watched.
  • A rollback plan exists: how to disable the exchange and how to correct bad data.

Troubleshooting

SymptomLikely causeWhat to do
Run fails at the first stepCredential or connectivity problemCorrect the Credential Vault entry, run the connectivity test, then rerun manually in non-production
Run marked Failed but data arrived downstreamA timeout in the chain ended the run firstCompare the exchange timeout with the gateway and load balancer limits; use the background pattern for long jobs
Background run stays in StartedThe final status call was never madeCall the process-log API once with Status, counts and message; check the processor's error path
Background run recorded as FailedStatus was missing from the final status callSend Status as true or false in the body
Row counts differ between source and ZnodeA filter, or rows rejected by ImportRead the Znode Import Log; check required columns and boolean and number formats
Processor is not calledProcessor File Name does not match the class nameFix the name in Admin and confirm the class is in Custom.Libraries.DataExchange
Mapped value is emptyWrong path or syntax variantCapture the sample again, check the step response on the Dashboard, and check the expression form ({{$Step1.Field}} in mappings, {{Step1.Field}} in endpoints and headers)
Duplicate records after a rerunNo stable match keyMatch and write by business key, and keep the re-run test in CI
Updates missed after a restartAn event was lostAdd or fix the scheduled reconciliation

FAQ

Can I test without a sandbox ERP?

Use a mock service or recorded responses for unit and mapping tests. For end-to-end tests you need a non-production ERP or PIM company. Do not test against production.

Is there a dedicated test mode for Data Exchanges?

The Znode documentation reviewed for this article says to trigger the exchange to test it and then review the logs. Use a manual run in non-production as your test mode.

How do I test a processor locally?

Unit test it with mocked IHandlerClient and IZnodeLogging. To test inside Znode, point the Custom API Root URI at a tunnel to your machine and switch it back afterward.

How often should I reconcile?

It depends on how much drift you can accept. A delta exchange with a weekly full reconciliation is a common starting point.

References

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.