Skip to main content
1 of 2

Pros and cons of using database dump in autotesting?

I'm going to write API and 2e2 auto-tests, and planning this encountered the problem of how to load test data needed to execute test cases. I see 2 approaches:

  1. Use api to create necessary resources.The problem with this approach is that it might be very complicated to create some resources, we will duplicate some logic that exists in front-end. And when api changes, testing helpers need to be changed as well. And if we stored some stub json files with data, we need to go though all of them and make changes.

  2. Create data though UI and save mysql dump, then load for each test appropriate dump. Benefits of this approach is that in case of api change, we don't need to change anything, just run migrations. But if 2 persons were changing same test in their feature branches, and then merge, it will be hard(impossible?) to merge 2 mysql dump files.

Which one is better, is there other alternatives. Personally I tend to use second one, is there any severe downsides of it?