Setting up the test environment

The preceding code defines a static method on the Droplet class so that we can create a server instance without having to write all of this code to configure it and can set the environment to test. We can set up a different database for test environment so that we can use that instead of our local development database, as we would need to reset or clear it every time after all tests finish running.

To set up environment-specific config file for using a different database for test environment, we will need to perform the following steps:

  1. In Xcode, inside the Config folder, create a new folder called development. Inside this folder, we can put any config files, and the configuration values from these files will ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.