🧹 Cleaning up after your integration test?
🛑 Stop doing that!
When you do an integration test, you often need to create a record in the database.
These tests are often wrapped in a try..finally statement, where the just created record is being cleaned up in the finally section.
❌ Don’t clean-up after te test.
✅ Do clean-up before you do the test!
Benefits:
✔️ Really start with a clean state, even when you are debugging your test and stop half-way.
✔️ Get rid of the try…finally statement around your test.
✔️ When the test fails, you can still review the created record for problems. It’s still there!