Automating API testing helps to increase the quality of the code by ensuring consistency and reducing human error.
The Spin CLI offers a built-in SQLite database, which is convenient for testing SQLite databases and clients locally, as well as automating API tests.
By coding an automated solution, automating API tests can document the step-by-step procedure, which is helpful when reviewing the process later or when someone new reviews it.
Requirements for running API tests on a local Spin application include the latest versions of Spin, TinyGo, and Hurl.
Hurl is used to automatically test the API endpoints, with syntax that includes verifying the HTTP status code and validating that the response body matches expectations.
The process to run API tests on a Spin app in Github actions is similar to running tests locally, but requires running the spin up command in the background, executing the tests, and then killing the process.
Automating API tests helps to catch issues earlier in the development cycle, saves time and resources, and ensures that APIs are always validated before they go live.
Integrating automated tests into a CI/CD pipeline improves developer experience and can reduce the toil of repetitive tasks.
Using Hurl and Github actions to automate testing of Spin APIs is an effective approach and the Spin API guide offers more information about other types of integrations.
Questions or comments can be addressed on the Spin Discord community.