I'm testing the api - after the request, I check that the values have appeared in the database. A simple example is I'm throwing JSON
{
"field_1": "Value_1",
"field_2": "Value_2",
"field_3": "Value_3"
}
And I need to check that these values have appeared in the DataBase. But there is a problem - not all the data has time to appear at the time of verification, that is, I read the database and there are the following fields
{
"field_1": null,
"field_2": "Value_2",
"field_3": "Value_3"
}
And after some time, the value field_1 appears.That is, the test fails because there is no value, I manually check the database - the value is there.There's just some kind of delay.
How can I find out before executing a query in the database that the Table has been completely updated?Are there ready-made solutions in Java? The developers told me that they need to make a separate API request that finds out whether the database has been updated or not - but it is very long and expensive. And the best way out for me would be to wait with Thread.sleep for 30 seconds after executing the request, so if nothing has been updated after 30 seconds, then there is definitely some kind of error.