Maurício, I always prefer to insert the data that I’ll be using in tests directly into the database, if it’s possible. I like this method because there’s no layer being able to cause a failing test.

I use data builders just when this isn’t possible, because, for example, if I need to do a search or an update test, I need to use a layer that’s able to insert that data. But, if we have a bug or a issue in the “post” method, the test using the “get” or the “patch”/“put” will fail, incorrectly, because the problem isn’t at those methods, but when I’m inserting using the “posts” method.

Can I get some hints about this?

Expand full comment