QA Interview Hub · Knowledge base · Quizzes · Українська

API

Checklist: what to test in an endpoint

What to check when testing an endpoint

An endpoint is checked in layers from the cheapest to the most expensive: status and time, headers, body, negative requests, security and system state. The first three layers cover one successful request, while negative requests, security and state get separate tests with their own data. The body is compared with the whole shape rather than one field, to catch an extra sensitive field such as a password hash.

API · Checklist

The test for an endpoint is green. How many layers of the response did it actually check?

A test for GET /v1/accounts/42 checks that the status is 200 and that a balance field exists. It has been green for a month. Then it turns out that the response had a passwordHash field all along, and the endpoint answered in three seconds under load. All of it was visible, nobody was looking: the check stopped at the first layer.

This lesson gives a short frame: which layers to check in every endpoint, in what order, and which of them belong to a single request and which to the whole system. The next lessons open these layers up in detail.

How it is built: the layers of a check

A request passes through several layers, and each of them can break independently of the others. That is why a check is best built from the bottom up: from the cheapest (did a response arrive at all) to the most expensive (did the system state change correctly).

The layers of checking one endpoint

1 status code and time 2 headers (Content-Type, cache) 3 body: schema, types, values 4 negative requests: 4xx, no 500 5 security: token, rights, others 6 system state after the request
Figure 1. Six layers. The last one is highlighted: it is checked least often and costs most when it breaks. Layers 1-3 look at the response itself, layers 4-6 go beyond it.

Why this way. The status and the time can be checked without parsing the body, headers without parsing the schema, so these checks are cheap and go first: if the status is already wrong, checking the schema is pointless. Negative requests, security and state need separate requests and prepared data, so they are written as separate tests instead of being appended to one "happy" scenario.

Each layer answers its own question. Status: did the server understand what happened. Headers: does the client know how to read the response. Body: is the data what the contract (Swagger/OpenAPI) promises. Negative requests: does the server withstand garbage. Security: does a user see only their own data. State: is the system after the request what it was supposed to become.

Example: from "status and one field" to all layers

Before: expect(res.status()).toBe(200) and expect(body.balance).toBeDefined(). A test like that lets this response through:

{
  "id": 42,
  "owner": "Olena",
  "balance": 1200,
  "currency": "UAH",
  "passwordHash": "$2b$12$..."
}

That is a leak of a sensitive field: a password hash must never be in the API at all. After: the test compares the body with the exact shape of the response, checks a header and a coarse time threshold.

test('GET account: every layer of the response', async ({ request }) => {
  const started = Date.now();
  const res = await request.get('/v1/accounts/42');
  const ms = Date.now() - started;

  expect(res.status()).toBe(200);
  expect(res.headers()['content-type']).toContain('application/json');
  expect(await res.json()).toEqual({
    id: 42,
    owner: expect.any(String),
    balance: expect.any(Number),
    currency: 'UAH',
  }); // toEqual fails on an extra field such as passwordHash
  expect(ms).toBeLessThan(1000); // a coarse threshold, not a benchmark
});

toEqual with a full object catches an extra field, a missing one and a type change, while toBeDefined on one field catches only the last. The time check here is deliberately coarse: in a single run it filters out obvious failures (seconds instead of milliseconds), and real measurements belong to a load test.

What to check depending on the method

A state-changing request (POST, PUT, PATCH, DELETE)

Besides the response layers I check layer 6: a repeated GET, related objects, side effects. Covered in the lesson "Beyond the response: side effects and system state".

A read (GET)

The state must not change: layer 6 turns into a check that the request changed nothing, plus cache headers.

Figure 2. The same frame, a different emphasis: for a write layer 6 matters most, for a read layers 3 and 5.

Limits and alternatives

  • Not every layer is needed in every test. The base set per endpoint is one "happy path" test with layers 1-3 and separate tests for layers 4-6. A test that checks everything at once fails with an unclear reason.
  • Checking the body against a schema (OpenAPI, JSON Schema) can be automated for all endpoints together, while value and state checks stay hand-written.
  • There are test generators from a contract (for example, Schemathesis) that cover layers 3-4 in bulk. They do not know business rules, so layers 5-6 stay with a person.
  • If there is no documentation the frame still works: expectations come from the behaviour, and differences are clarified with the developer.

Common mistakes

  • Stopping at the status. Defects in headers, types and extra fields go unnoticed, and the client fails in production.
  • Checking one field instead of the shape. An extra sensitive field is not caught by any "field exists" check.
  • Writing only positive tests. Negative requests find most validation defects, and without them layer 4 is empty.
  • Not looking at the state after a write. A 201 only proves that the server said so.
  • A strict time threshold on a shared environment. The test becomes flaky from network noise, so the threshold gets a margin and exact measurements go to load tests.

Check yourself

An endpoint returns 200, the Content-Type is right, the needed fields are there. Why is that not enough to call it tested?

Answer

Only layers 1-3 were checked, for one successful request. It is unknown what happens with bad data (layer 4), whether a user sees someone else's data (layer 5) and whether the state changed correctly (layer 6). Also the body may have contained extra sensitive fields if the check went field by field instead of covering the whole object.

Why are negative requests, security and state written as separate tests instead of being added to one?

Answer

Each needs its own data and its own request, and a failure of one must not hide the others. One big test stops at the first failure and does not show the rest. Also, the name of a separate test says at once what broke.

In an interview. Junior: I check the status, the structure and types of the response, headers and time. I add negative requests: missing fields, wrong types, a non-existent id, no token. Middle/Senior: I build the check in layers: status and time, headers, body against the contract, negative requests, security (token, rights, other people's data), system state after the request. I compare the body with the whole shape to catch extra sensitive fields. For writes I check side effects separately. The bulk layers 3-4 can go to a generator from OpenAPI, while business rules and security I write by hand.

Positive and negative cases

A positive case proves the endpoint does what it promises on valid data, and a negative case proves it rejects invalid data correctly. There are usually more negative cases, because each field can be broken in several ways: missing, null, empty, wrong type, out of range. Boundaries are tested in pairs, on the edge and just beyond it, and the status is checked exactly rather than as any 4xx.

API · Checklist

Sign-up rejects age 18, although 18 is the minimum. Which set of cases would have found it?

The endpoint POST /v1/users requires an age from 18 to 120. The developer wrote the condition age > 18 instead of age >= 18, so eighteen-year-old users now get rejected. A test with age 30 is green. Only a case on the boundary finds the bug, and for such cases not to depend on inspiration you need a list to walk through for every new endpoint.

Below: what goes into positive and negative cases, why there are usually more negative ones, and how to write them down in a table so that a new case costs one row.

How it is built

A positive case proves that the endpoint does what it promises when the data is right. A negative case proves that the endpoint rejects correctly when the data is wrong. For every negative request there are two questions: which exact status is expected, and whether the error has a form a client can use.

Positive cases:

  • a valid request gives the right status, schema and field values;
  • the record really was saved: a repeated GET or a database query;
  • only the required fields and all fields together: two different sets;
  • pagination, filters, sorting; an empty result is [], not an error;
  • response time within the SLA.

Negative cases:

  • a required field is missing, the value is null, an empty string;
  • a wrong type: a string instead of a number, an array instead of an object;
  • boundaries: 0, minimum minus one, the minimum, the maximum, maximum plus one, very long strings;
  • invalid JSON and a wrong Content-Type (400 and 415);
  • a non-existent id (404), an unsupported method (405);
  • a duplicate of a unique value (409);
  • in every case a 4xx with a clear message and no 500.

What positive and negative cases prove

Positive cases

They prove: the endpoint does what it promises. A few sets (minimal, full), a check that the data was saved. They find logic errors and response format errors.

Negative cases

They prove: the endpoint rejects correctly and safely. There are more of them because wrong inputs are endless. They find validation errors, boundary errors and 500 instead of 4xx.

Figure 1. The two kinds of cases complement each other. Neither replaces the other.

Why there are more negative cases. There are usually one or two right inputs and endless wrong ones: each field can be broken in several ways (missing, null, empty, wrong type, out of range, special characters). Besides, validation often has "one step aside" errors such as > instead of >=, and they show only on the boundaries.

Example: a table of cases and a bug on the boundary

Before: one test with age 30. After: a table where each row describes one input and the expected status. Adding a case means adding a row.

const mail = () => 'u' + crypto.randomUUID().slice(0, 8) + '@shop.test';

const cases = [
  { name: 'age 18 (minimum)', body: { email: mail(), age: 18 }, status: 201 },
  { name: 'age 120 (maximum)', body: { email: mail(), age: 120 }, status: 201 },
  { name: 'age 17', body: { email: mail(), age: 17 }, status: 422 },
  { name: 'age 121', body: { email: mail(), age: 121 }, status: 422 },
  { name: 'age as a string', body: { email: mail(), age: '30' }, status: 422 },
  { name: 'email is null', body: { email: null, age: 30 }, status: 422 },
  { name: 'email missing', body: { age: 30 }, status: 422 },
  { name: 'email is empty', body: { email: '', age: 30 }, status: 422 },
];

for (const c of cases) {
  test('POST /v1/users: ' + c.name, async ({ request }) => {
    const res = await request.post('/v1/users', { data: c.body });
    expect(res.status()).toBe(c.status);
    if (c.status === 422) {
      expect(res.headers()['content-type']).toContain('json');
      expect(await res.text()).not.toMatch(/Exception|SELECT /);
    }
  });
}

The negative rows also check the error format: a JSON body without an exception or SQL mention. Suppose the row "age 18 (minimum)" fails with 422 instead of 201: the condition on the boundary is written too strictly. A test with age 30 would never have seen that.

Cases that do not fit a table with a body (broken JSON, a duplicate) are written as separate tests:

test('malformed JSON gives 400, not 500', async ({ request }) => {
  const res = await request.post('/v1/users', {
    headers: { 'Content-Type': 'application/json' },
    data: Buffer.from('{"email": "a@shop.test", "age": '),
  });
  expect(res.status()).toBe(400);
});

test('duplicate email gives 409', async ({ request }) => {
  const body = { email: 'dup-' + crypto.randomUUID().slice(0, 8) + '@shop.test', age: 30 };
  expect((await request.post('/v1/users', { data: body })).status()).toBe(201);
  expect((await request.post('/v1/users', { data: body })).status()).toBe(409);
});

In the first test data is a Buffer: Playwright sends such bytes as is, and the server receives truncated JSON. With a JSON Content-Type, a string that does not parse as JSON is JSON-encoded, and the server would receive valid JSON. In the second, the first request is enough to create a record, and the second one with the same email must give 409. The unique suffix makes the test repeatable.

Limits and alternatives

  • The table does not replace equivalence class analysis: first the input is split into classes, then values on the boundaries of each are taken. That is the topic of a separate test-design chapter.
  • The exact status for each case comes from the contract. If one team returns 400 and another 422 for the same error, that is a question for API design, not for the test.
  • Field combinations (two fields, each valid alone but not together) are only partly covered by a "one input per row" table: they are added as separate rows.
  • Property-based tools (fast-check, Schemathesis) generate wrong inputs themselves. They complement a table well but do not know which code is right for a business rule.

Common mistakes

  • Checking "any 4xx". A test status >= 400 lets a swap of 422 for 500 or of 404 for 403 through, so the status is checked exactly.
  • Skipping boundaries. The minimum and the maximum are checked, and so are the values next to them: just outside and just inside.
  • Not checking the error body. A valid 4xx with a stack trace or HTML breaks the client and reveals details.
  • Shared data between cases. A duplicate needs a record known in advance, so each case creates its own data and does not depend on the run order.

Check yourself

The field quantity accepts integers from 1 to 10. Which values do you check on the boundaries and why these?

Answer

0, 1, 10 and 11. 1 and 10 must pass, 0 and 11 must be rejected: a "one step aside" error (> instead of >=) shows up exactly on these four values. Additionally minus one, a fractional value (1.5) and a string: those are other classes of wrong input.

A negative case returns 500 with the text of an exception. The test checked only status >= 400 and was green. What is wrong?

Answer

The right behaviour here is a 4xx (the client sent bad data), while 500 means an unexpected server error and often a leak of details. A check for "any 4xx" does not distinguish it from the needed 422 or 400, so the status must be checked exactly and the body checked for the absence of exceptions.

In an interview. Junior: First the positive cases: status, schema, values and a check that it was saved through GET. Then the negative ones: missing fields, wrong types, boundaries, invalid JSON, a non-existent id, duplicates. In every case I expect a 4xx with a clear message, not a 500. Middle/Senior: There are more negative cases because there are more wrong inputs, and they find validation errors. I keep the cases in a table: input, the exact expected status, a check of the error format. I take boundaries in pairs, just outside and on the boundary, because a > instead of >= shows up only there. For field combinations and wrong inputs I did not foresee I add generation from the schema.

Security and fintech

API security checks who can see and do what: 401 without a valid token, 403 for a role without rights, no foreign data by id (IDOR). Fintech adds requirements that follow from the nature of money: exact amounts without floats, zero and negative values, ISO 4217 for currencies, and idempotency through Idempotency-Key with no double debit. A foreign resource is checked with a separate user.

API · Checklist

User A requests the account of user B and gets 200. What else was left unchecked?

In a financial API broken access costs more than a broken interface: a stranger's account can be peeked at, a transfer can be debited twice, and the cents can "float" in reports. A functional test for 201 does not see this, because each of these problems lives outside the happy path.

Below: what is checked in security and access, what fintech adds, and why these checks are not part of a typical set.

How it is built: two lists

Security and access answers the question "who can see and do what".

  • no token, an expired token, a tampered token: 401;
  • a role without rights: 403;
  • someone else's id in the URL: no foreign data (IDOR, in OWASP terms "broken object level authorization");
  • the response has no passwords, full card numbers, internal fields;
  • SQL injection and special characters in string fields do not break the request;
  • rate limiting: 429 after the limit, ideally with Retry-After.

Fintech adds requirements that follow from the nature of money.

  • amounts are exact: 0.1 + 0.2, rounding, cents;
  • a negative amount, zero, an amount above the balance or the limit;
  • a repeat with the same Idempotency-Key: no double debit;
  • currency: ISO 4217 codes, an unsupported currency;
  • the balances of the sender and the receiver add up, and on an error nothing is partly debited;
  • dates and time zones: the ISO 8601 format, operations near midnight.

Why money needs separate attention. Floating-point numbers cannot represent most decimal fractions exactly, because they are stored in binary. That is why ordinary arithmetic gives surprising results:

console.log(0.1 + 0.2);                // 0.30000000000000004
console.log(Math.round(1.005 * 100));  // 100, not 101: 1.005 * 100 is 100.49999999999999

If a backend or a frontend counts money in a float, the cents sooner or later "float away". So amounts are stored in decimal types or as integers of the minimal unit (cents), and are sent in JSON as an integer number of units or as a string with a decimal point.

How to store an amount

Typical

A floating-point number

"amount": 0.1 in a float. The sum of a hundred such payments is not exactly ten, and rounding depends on who counts.

Better

Integer minimal units or a decimal string

"amountMinor": 10 or "amount": "0.10". Addition is exact, rounding is set by a rule, not by chance.

Figure 1. The same payment, two ways to write it. The second gives no accumulating error.

Example: two tests that catch the most expensive bugs

Idempotency: a client repeats a request after a dropped connection, and the money must not be debited twice. The test sends the same request with the same key twice and looks at the balance.

test('the same Idempotency-Key does not charge twice', async ({ request }) => {
  const before = await balance(request, 42);
  const key = crypto.randomUUID();
  const send = () =>
    request.post('/v1/accounts/42/transfers', {
      headers: { 'Idempotency-Key': key },
      data: { toAccount: 'UA21...', amountMinor: 10000, currency: 'UAH' },
    });

  const first = await (await send()).json();
  const second = await (await send()).json();

  expect(second.id).toBe(first.id); // the replay returns the same transfer
  expect(await balance(request, 42)).toBe(before - 10000); // debited once
});

The status of a repeat (the same 201 or 200) depends on the contract, so the test compares not the status but what matters: the same transfer id and a single debit. Per the IETF draft, 409 is returned while the first request with this key is still being processed. The balance function is a helper here: it reads the balance through GET.

Access to someone else's data: user A asks for a resource of user B.

test('user A cannot read the account of user B', async ({ request }) => {
  const res = await request.get('/v1/accounts/' + accountOfB.id, { headers: authA });
  expect([403, 404]).toContain(res.status()); // which one is decided by the contract
  expect(await res.text()).not.toContain(accountOfB.owner);
});

Both 403 and 404 are allowed: for someone else's resource 404 is often returned so as not to reveal that such an id exists. The contract decides which. The main check is in the second line: the response has no foreign data, even if the status looks "nice".

Limits and alternatives

  • This lesson is about what to check, not a full pentest. A deep look at access, JWT and injections is in the API security chapter; here is only the minimum every set must have.
  • Idempotency through the Idempotency-Key header is not finally standardised (there is an IETF draft), so details, including what to answer to a repeat with a different body, depend on the service and are described in its documentation.
  • Rate limiting and injections are risky to test on a shared environment: bulk requests can block others, so this is done on a separate environment.
  • Fintech may have extra requirements (PCI DSS for cards, regulatory ones for payments): they are checked against the product requirements, not against this list.

Common mistakes

  • Checking only a missing token. An expired, a tampered and another user's token behave differently, and the bugs live exactly there.
  • Counting on the UI not letting it happen. The interface does not show someone else's id, but the API accepts it, so IDOR is checked at the request level.
  • Comparing amounts with toBe on fractional numbers. The test fails with an error that is a sign of a real storage problem, not a trifle.
  • Not checking a partial failure. If the second half of a transfer failed, the first must not stay done.

Check yourself

A request of user A to /v1/accounts/{someone else's id} returns 404. Is that right or not?

Answer

It is acceptable and even desirable if the contract says so: 404 does not reveal that such an id exists. Another acceptable option is 403. The bug starts when 200 or any foreign data is returned. The test checks that the status is from the allowed set and that the body contains no foreign data.

A client repeated a payment with the same Idempotency-Key, and the account has two debits. What exactly went wrong?

Answer

The server did not link the key to the result of the first request, so it processed the repeat as a new payment. The right behaviour: return the same stored response, with no new debit. The test should compare the number of debits and the transfer id, not only the status of the repeat.

In an interview. Junior: For security I check 401 without a token, 403 for a role without rights, access to someone else's resource by id, no sensitive data in the response and rate limiting. In fintech I add exact amounts, zero and negative values, currencies per ISO 4217. Middle/Senior: Amounts are not fractional numbers but integer minimal units or decimal strings, because a float accumulates error. I check idempotency with two identical requests with the same key: the same result and a single debit. I check someone else's resource with a separate user and look for a leak even in a 404 body. I check the balances of both sides and the absence of partial debits after every error.

Beyond the response: side effects and system state

After a state-changing operation, separate requests check the system itself, not only the response: a 201 with correct JSON proves nothing. What had to happen: the record saved, related objects changed, a side effect exactly once. What must not: half-created records, others' data, duplicates. The owner comes from the token, and async effects are awaited by polling, not a pause.

API · Checklist

The response is 201, the JSON is perfect. Did the money really leave the account?

A 201 response with correct JSON does not yet prove that the endpoint works: it had to do something in the system, and that is what breaks most often. A transfer returned tr_91 but the recipient's balance did not change. An order was created but the stock did not decrease. A confirmation email went out twice. All of it is visible only when you look not at the response but at the system after it.

Below: what to check after every state-changing operation, why this is the layer most often skipped, and how to check side effects that arrive with a delay.

How it is built: three questions after every operation

An operation that changes state has consequences beyond the response. For each one ask: what else should have happened, and what should not have?

What should happen:

  • the record is saved: a repeated GET returns the same data, and after DELETE it is 404;
  • related objects changed: both balances after a transfer, the stock after an order;
  • a side effect appeared: an event in a queue, an email, a webhook, an audit log record, exactly once;
  • service fields are filled: createdAt, updatedAt, id, the owner comes from the token, not from the request body.

What should not happen:

  • a failed request changed nothing: after 400 or 409 there are no half-created records or debited money;
  • someone else's data did not change: a request of user A did not touch resources of B;
  • a repeat of the same request did not create a duplicate (idempotency, unique constraints).

The response only versus the response and the state

Typical

The response only

Status 201 and the shape of the JSON. It proves that the server answered, not that it did anything. A balance that did not change goes unnoticed.

Better

The response and the state

After the request we read the balances, the event and the record separately. The defect is seen in the test, not in a customer complaint.

Figure 1. The same five lines of a test, but the second approach checks what the request was made for.

Why it is built this way. An API only describes what happened: the response is formed by the handler code, while state changes are done by a separate layer (a database, a queue, an external service). They can diverge: the handler answered with success while the transaction rolled back or an event got lost. That is why the state has to be looked at with a separate request that does not depend on the response to the first one.

Example: a transfer that "passed" but did not change the balances

There was a test that checked only 201. After: we check the balances of both accounts and the event in the log.

test('transfer changes both balances and writes one audit record', async ({ request }) => {
  const a = await balance(request, 42);
  const b = await balance(request, 43);

  const res = await request.post('/v1/accounts/42/transfers', {
    headers: { 'Idempotency-Key': crypto.randomUUID() },
    data: { toAccount: '43', amountMinor: 5000, currency: 'UAH' },
  });
  expect(res.status()).toBe(201);
  const transfer = await res.json();

  expect(await balance(request, 42)).toBe(a - 5000);
  expect(await balance(request, 43)).toBe(b + 5000);

  // the event is written asynchronously: poll instead of a fixed sleep
  await expect
    .poll(async () => {
      const ev = await (await request.get('/v1/accounts/42/events')).json();
      return ev.filter((e: { transferId: string }) => e.transferId === transfer.id).length;
    })
    .toBe(1);
});

The balances are read with a separate GET, so the test does not rely on the response to the transfer. The event in the log is written asynchronously, so instead of a fixed sleep the test uses expect.poll: it repeats the function until the result is the expected one or the timeout runs out. The "exactly once" check catches both duplicate and missing events.

The negative side is just as important: a rejected request must leave no traces.

test('a rejected transfer changes nothing', async ({ request }) => {
  const a = await balance(request, 42);
  const b = await balance(request, 43);

  const res = await request.post('/v1/accounts/42/transfers', {
    data: { toAccount: '43', amountMinor: a + 1, currency: 'UAH' }, // more than the balance
  });
  expect(res.status()).toBe(409);

  expect(await balance(request, 42)).toBe(a);
  expect(await balance(request, 43)).toBe(b);
});

Here is a 409 for an amount above the balance (other APIs return 422: the contract sets the exact code), and right after it a check that both balances did not change. A test with an error that ends with a status check alone does not see half-debited money.

Limits and alternatives

  • State is most often checked through other endpoints of the same API (a GET of the created resource, balances, the event list). That does not tie the test to the internal schema.
  • Direct SQL or reading a queue is used when the API does not show what is needed. It is reliable but ties the test to the database structure: renaming a column breaks it with no change in the API.
  • Asynchronous effects (an email, a webhook) are checked by polling with a sensible timeout, or with a test mailbox or a webhook stub, not with a fixed pause.
  • A read (GET) does not change state, and the "state" layer here comes down to checking that the request changed nothing, for example a repeated GET returns the same.
  • Consistency in distributed systems can be only eventual, so "right after the request" the state may not be updated yet. This is agreed with the team, and the test waits by polling, not with an inflated sleep.

Common mistakes

  • A fixed pause instead of waiting for a condition. The test either fails on a slow environment or slows down for nothing. Better expect.poll or toPass.
  • Not checking the negative scenario. After an error the state did not change, but nobody looked, so half-created records pile up.
  • Taking the owner from the request body. A user will substitute someone else's id, so the owner is set from the token. The test checks that the value from the body is ignored.
  • Checking only one side. After a transfer the sender, the recipient and the log all change.
  • Relying on the response body instead of a separate read. A response may describe the intended state, not the actual one.

Check yourself

After DELETE /v1/orders/7 a 204 arrived. What do you check to make sure the deletion happened?

Answer

A repeated GET /v1/orders/7 must give 404. I also check the consequences: that the stock was returned, that the order is gone from the list, and that a repeated DELETE behaves per the contract (404 or 204). A 204 on its own only says the server considers the request done.

An event appears in the log a second or two later. Why is await page.waitForTimeout(3000) worse than expect.poll here?

Answer

A fixed pause is either too long and slows the suite, or too short and gives flaky failures on a slow environment. expect.poll repeats the check until the condition holds and has its own timeout, so the test waits exactly as long as needed.

In an interview. Junior: After an operation that changes data I check not only the response but also that the record was really saved through GET, and that after an error nothing changed. Middle/Senior: I look at three things: what should have happened (saving, related objects, side effects exactly once), what should not have happened (half-created records, someone else's data, duplicates), and that service fields, the owner in particular, come from the token. I read the state with separate requests and wait for asynchronous effects by polling, not with sleep. Direct SQL is for when the API does not show what is needed, because it ties the test to the database schema.