Recently I started writing tests for our API. However, I have faced some issues which I think it is critical to think at the start.
How should I structure my tests in terms of setup and cleanup phase(test data management)? Should I set necessary objects in a test in pre-req section to make the test independent on others? I followed this approach but I couldn’t find a way to send requests synchronously(callbacks can get messy).
On the other hand, I made a different approach which is basically using objects created in previous tests. But this makes the tests unmaintainable and very difficult to keep track of.
Are there any other approaches on test data management? Or should I do things differently?