Test setup

ebean-test is used to setup and configure Ebean for running tests.

1. Add ebean-test as a test dependency

<dependency>
  <groupId>io.ebean</groupId>
  <artifactId>ebean-test</artifactId>
  <version>12.11.3</version>
  <scope>test</scope>
</dependency>
dependencies {
    ...
    testCompile 'io.ebean:ebean-test:12.11.3'
}

2. Add application-test.yaml

In src/test/resources add application-test.yaml configuration file like the one below.

ebean:
  test:
    platform: h2 # h2, postgres, mysql, mariadb, oracle, sqlserver, hana, clickhouse, sqlite
    ddlMode: dropCreate # none | dropCreate | migration
    dbName: my_app

We can change the platform to any of the supported platforms. Ebean test will automatically manage a docker test container setting it up to run tests. Refer to testing for more information.