Testing the Repository
Explore integration testing techniques for repository implementations in Scala HTTP APIs. Learn to manage database setup, execute tests for loading, saving, and updating products, and apply ScalaCheck for data generation. Understand handling asynchronous operations and database constraints in functional service testing.
We'll cover the following...
We'll cover the following...
Global operations
Now that our parts are in place, we can write an integration test for our repository implementation. First, we need to do some things globally for the test scope.
Here, we clean our database, run the migration, and after we have executed all the tests, close the repository.
Remember: not cleaning the database between tests might be an even more thorough test. ... ...