Playwright · Senior · Question 40 of 77
When is it reasonable to seed data directly in the database?
- 1Always, because it is faster than any other method
- 2When no API exists and the schema is stable and owned
- 3Never, because tests must only use the user interface
Show the answer
Correct answer: When no API exists and the schema is stable and owned
Explanation
Direct SQL is fast but couples tests to the schema and can skip business logic. Public or test APIs are usually safer.