Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Databases, SQL & BIDatabase conceptMiddleCommonTheory

What database risks should integration tests cover beyond checking that a row exists?

Answer

Check constraints, transactions, isolation, defaults, migrations, referential integrity, concurrent updates, encoding, time zones, audit fields and rollback behaviour. Validate through supported interfaces unless direct database access is explicitly part of the test objective.

Strong answer includes

  • integrity and transactions
  • concurrency and migrations
  • appropriate observation layer

Practical example

Validate database integrity beyond row existence
Dialect · Portable SQLRuntime · SQLite sample DB

Runs against the sample database, which intentionally contains one orphan order so the integrity query demonstrates a real failure.

SQL
SQLite · sample DB · browser sandbox
Result
Run the query to see the result.

A database integration check should verify invariants, not only that an INSERT produced a row. Use SQL to look for broken relationships and invalid persisted state, while separate tests exercise transaction rollback, isolation/concurrency, migrations, encoding and time-zone behavior through the supported application or database boundary.

Expected result: In the sample fixture the first query intentionally returns the orphan order; a healthy production integrity check should return zero rows. The persisted-state query should return zero rows.

#database#transactions#integrity

Sources

PostgreSQL documentationPostgreSQL Global Development Group · Relational modelling, SQL, joins, constraints, transactions, concurrency, indexes, query plans and recoveryDOU — QA interview: 250+ questionsDOU · Coverage signal across Junior, Middle, Senior, AQA, web, mobile and practical topics