Clarifying CUBA's attitude to working with test databases

Hello
I would like to clarify CUBA’s approch for running integration tests. As far as I got it from docs, CUBA doesn’t support running integration test against databases of different types than specified in a project. So if a project use Postgres there is no simple way to run tests using HSQL for example. Is it right?
Thanks in advance for answers!

Hi Ilia,

You can run tests against any database as long as it exists and has schema conforming to the project’s model. For example, you can generate init scripts for both Postgres (production) and HSQL (test) databases. This is not very convenient in Studio, but possible - you should switch the database type before generating scripts.

Also, you should add a separate Gradle task for creating the test database and set up the test container to use this database as described in the docs.

However, I would suggest running integration tests on the same database type as using in production, by the obvious reason - it will be closer to reality.

2 Likes

Hello, Konstantin,
thank you for taking the time to answer my question so quickly and clearly.