Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (61 sloc) 2.05 KB
<meta name="layout" content="_layout/docs.html"/>
<meta name="bread1" content="Testing" href="/docs/testing/"/>
<template id="menuNav"><#include "/_layout/_docs_nav_testing.ftl"></template>
<#assign testing="active">
<h2>Ebean test</h2>
<h3>1. Add ebean-test as a test dependency</h3>
<h3>2. Add application-test.yaml</h3>
Add into <code>src/test/resources</code> a <code>application-test.yaml</code> configuration file
that we use for testing.
platform: h2 #, h2, postgres, mysql, oracle, sqlserver, hana, clickhouse, sqlite
ddlMode: dropCreate # none | dropCreate | create | migration | createOnly | migrationDropCreate
dbName: my_app
We can modify this test configuration to control what DDL is executed (create-all.sql or migrations)
and the database platform we want to test against (potentially using docker).
<h3>3. Add ~/.ebean/ignore-docker-shutdown</h3>
mkdir ~/.ebean
touch ~/.ebean/ignore-docker-shutdown
For running tests on CI servers we typically want to stop and remove the docker containers
when the tests have completed. However, for local development we want to keep the docker containers
running making it faster to run tests.
Adding a marker file <code>~/.ebean/ignore-docker-shutdown</code> means the docker containers
will stay running (which is good for local development).
ebean-test will take care of:
<li><a href="ddl-mode">DDL generation</a> and execution modes</li>
<li><a href="docker">Docker test container</a> setup and execution based on the database platform</li>
<li><a href="current-user-tenant">Current user and tenant</a> provider if not already specified (to ease testing with @Who properties etc)</li>
<@next_edit "DDL Mode" "ddl-mode" "/docs/testing/index.html"/>
You can’t perform that action at this time.