Back

Database Integration Tests in Java

  • 0
  • Self Hosted
  • Databases
Marc
23 Apr, 2024, 17:44

I'm running an appwrite instance using the docker installation and for database communication I use Java which works fine. For my software I want to write integration tests.

Usually with other databases I create a new container in Java using testcontainers and then I execute the tests. So to be clear what's happening is I run the tests, at the beginning a new container for the database is created and the tests use this container for the data to test. How can I implement integration tests for the appwrite database? I don't want to mess with the production database when testing.

Appreciate any help

TL;DR
Developers want to create database integration tests for Appwrite without affecting the production database. They can use testcontainers to spin up an Appwrite container for their tests. Check the docker files on the Appwrite documentation page for guidance.
Steven
24 Apr, 2024, 02:52

You can do the same: spin up an Appwrite container. We do that in our integration tests.

Marc
24 Apr, 2024, 05:11

Perfect thank you. Is there an example how you create a container for the tests on GitHub? I couldn’t find it

Steven
24 Apr, 2024, 05:27

You could use the docker files here: https://appwrite.io/docs/advanced/self-hosting#manual

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more