python – Data Configuration for Integration Testing: Using SQL Queries or API Calls

Using HTTP requests to populate data in your repository adds another potential layer to failure, as well as a little extra latency. If the API changes, you will also need to change your test settings, for example.

At the same time; if your API dictates how things are stored in the SQL repository, if the SQL schema changes, you will need to modify the queries directly for the test configurations, whereas if you used the API, you would not do it .

For me, these are the main advantages / disadvantages that you must weigh. I would choose the one that is least likely to change, the SQL schema or the API.