Declarative snapshot & reconciliation testing
Snapline compares APIs, databases, and JSON fixtures as data — not imperative assertion chains. Configure what should match, how to normalize volatile fields, and how to map codes across systems in one object.
Snapline is an open-source integration testing framework from VaagaTech (www.vaagatech.com) — declarative test automation for APIs, databases, and JSON fixtures.
Purpose
Integration tests often devolve into dozens of brittle field assertions that break when schemas evolve. Snapline flips the model: you declare a golden snapshot and reconciliation rules, and the framework handles HTTP, auth, fetching rows, deep comparison, and structured diffs.
API ↔ file
Call REST, GraphQL, or SOAP and compare the response to a JSON fixture after normalization.
DB ↔ DB
Query two databases (same or different SQL) and compare rows — including NoSQL document stores.
API ↔ DB
Verify an API response matches a database row, or drive an API call from a DB row.
Fixture cases
Run many pass/fail scenarios from a fixtures/cases/ directory with minimal per-case JSON.
Queue → poll
Publish to Kafka or a message queue, then poll SQL or the filesystem for async results.
Why Snapline?
Traditional tests look like this:
expect(response.status).toBe(200);
expect(response.body.email).toBe('alice@example.com');
expect(response.body.status).toBe('synced');
expect(response.body.currentdate).toMatch(/^\d{4}-\d{2}-\d{2}/);
With Snapline:
const result = await testSuite('User sync', {
baseUrl: process.env.API_BASE_URL,
api: {
endpoint: '/api/v1/user/sync',
method: 'POST',
inputFile: './fixtures/input.json',
expectedFile: './fixtures/expected.json',
ignoreFields: ['pincode'],
transformations: {
currentdate: (v) => isValidDate(v) ? 'VALID_DATE' : 'INVALID_DATE',
},
},
});
process.exitCode = result.passed ? 0 : 1;
Install
npm install @vaagatech/snapline-core
# Optional — messaging queues (Kafka, in-memory):
npm install @vaagatech/snapline-messaging-adapters
One package re-exports the engine, API adapters, auth adapters, fixture runners, and reporting.
SQL uses the DbConnectionLike contract (bring your own driver).
Queues use @vaagatech/snapline-messaging-adapters with publishAndPoll.
See Getting Started for a 5-minute walkthrough.
Reconciliation pipeline
Every comparison runs the same pipeline on the live side before deep compare: