Skip to content
Permalink
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
<html>
<head>
<title>Introduction</title>
<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">
</head>
<body>
<h2>Ebean test</h2>
<h3>1. Add ebean-test as a test dependency</h3>
```xml
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>11.44.1</version>
<scope>test</scope>
</dependency>
```
<h3>2. Add application-test.yaml</h3>
<p>
Add into <code>src/test/resources</code> a <code>application-test.yaml</code> configuration file
that we use for testing.
</p>
```yml
ebean:
test:
platform: h2 #, h2, postgres, mysql, oracle, sqlserver, hana, clickhouse, sqlite
ddlMode: dropCreate # none | dropCreate | create | migration | createOnly | migrationDropCreate
dbName: my_app
```
<p>
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).
</p>
<h3>3. Add ~/.ebean/ignore-docker-shutdown</h3>
```sh
mkdir ~/.ebean
touch ~/.ebean/ignore-docker-shutdown
```
<p>
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.
</p>
<p>
Adding a marker file <code>~/.ebean/ignore-docker-shutdown</code> means the docker containers
will stay running (which is good for local development).
</p>
<h2>ebean-test</h2>
<p>
ebean-test will take care of:
</p>
<ul>
<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>
</ul>
<@next_edit "DDL Mode" "ddl-mode" "/docs/testing/index.html"/>
</body>
</html>
You can’t perform that action at this time.