Transactions in Unit Tests?

I’m wondering the purpose of using my database to test a function that inserts data. I don’t even use my database when it comes to selecting data, and other matters that don’t need to call for the DB in a test. Obviously, if I’m going to insert data in my test, it’s going to stay there unless I wrap it in a transaction. When unit testing at this stage I tend to think it becomes less of a unit test and more of an integration test.

But my overall question, is it a common practice to do so? Please point me in another direction if there is a better practice.

Sounds to me like you’re looking for fixtures :slight_smile: