Unit Test Against In-Memory vs Real Database for SwiftData Applications

  softwareengineering

I am writing unit tests for my SwiftData application. Currently, I am using in-memory database, which get reset after every test. What benefits will I gain if I start using real database? My main reason is that real database (SQLite) will be the environment user will experience. I can easily wipe out the records from the real database after each test is completed.

Are there are scenario where running in-memory test will produce a different result as compared to running the test with real database? Am I ignoring and not capturing those scenarios by running it in-memory?

PS: I used the term unit tests. You can use integration test if that makes you feel better 🙂

New contributor

user19037628 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT