API Testing · Senior · Question 63 of 75
How do you test database migrations that change an API's data?
- 1Run them on realistic data, check API reads and writes before and after
- 2Run them on an empty database and check that no errors appear
- 3Migrations affect only the database, so APIs need no tests
Show the answer
Correct answer: Run them on realistic data, check API reads and writes before and after
Explanation
Expand-and-contract migrations keep old and new code working. API tests run against both phases.