Date: 2025-04-25
Time: 16:00–16:45
Room: West
Level: Intermediate
Efficiently managing a clean PostgreSQL database between integration tests is essential for ensuring accurate and reliable test outcomes. In this talk, we explore strategies to clean and reset a PostgreSQL database state between test runs without sacrificing performance. We will discuss the drawbacks of common approaches like in-code cleanups, truncating tables or dropping schemas. Finally, we will introduce a language-agnostic solution that uses PL/pgSQL functions, triggers, procedures and the information schema to automatically clean database tables between tests. By leveraging this solution, developers can achieve faster, more consistent integration tests, ultimately improving the reliability of their test suites and enhancing overall development productivity without needing major refactoring in their codebase.
Keywords: "Integration Tests", "Application Development", "PL/pgSQL", "Triggers", "Information Schema", "Procedure"