We're figuring out whether we should write acceptance tests that revolves around preloaded data on a database file, or programmatically added needed data per test, or filling database while testing other application features.This is a more detailed, easy use case: you want to acceptance test (or UI-test) adding a Book to the system. But in order to do that, you need to have Category rows in the database already, so you can assign one to the book. As you're writing your test case for adding a book, you:Use a previously seeded database file that has already categories in it.cons would be you need to keep that file up with every change in the code, with the latests changes on the system, AND you'd need to fill it while considering additional business logic (i.e. maybe you seeded authors with random parameters; but turns out an author can't be selectable unless it passes x, y and z conditions; and the seeder didn't take that in consideration)Programmatically add the category in the test.cons would be you need to keep up with additional business logic, again.Each tested feature retains data, so you first run acceptance test for adding categories, and then for adding a book.cons would be your testing tool would need not to isolate tests, or at least run them in a certain order.Maybe there's a 4th option I haven't considered yet? What's the correct approach for this common task?
Acceptance testing with preloaded data or filling it on the go
testing;acceptance testing
We are doing it second way. The best will be to show it by example (python):def test_that_we_can_add_book_to_library(self):    category = Category('Fantasy')    self.library.add_category(Category('Fantasy'))    book = Book(Title('Hobbit'), category)    self.library.add_book(book)    self.library.has_book(book)What is important here is a fact that library is an object created for tests only. It has behaviours that encapsulates logic (that can change) needed for tests.  Additionaly it makes test more readable.library.add_category is such behaviour, if anything changes in business logic related to category, then we change it only there. library.has_book is an assert method that checks if book was added to our storage.It is really well described in the book Growing object-oriented software: Guided by tests. Everyone that wants to write good tests should read it imho.