Git Product home page Git Product logo

testflight's Introduction

maintained maven central build sonarcloud sonarcloud sonarcloud sonarcloud

Testflight.Space

Testflight.Space is a JUnit 5 extension for flyway to mandate fast database tests with real databases and real flyway migrations.

Simply annotate your JUnit 5 test with @Flyway and a fresh database will be started for every test execution.

Accessing the database

After starting the database Testflight.Space will inject the connection properties into Java system properties. By default the following properties are used;

space.testflight.jdbc.url
space.testflight.jdbc.username
space.testflight.jdbc.password

You can change the property names via:

@Flyway(configuration = {
  @ConfigProperty(key = "space.testflight.jdbc.url.property", value = "javax.persistence.jdbc.url"),
  @ConfigProperty(key = "space.testflight.jdbc.username.property", value = "javax.persistence.jdbc.user"),
  @ConfigProperty(key = "space.testflight.jdbc.password.property", value = "javax.persistence.jdbc.password")
})

Supported databases

Flyway extension internally uses Testcontainers to start databases so every database that is supported by Testcontainers will be supported eventually. Currently only PostgreSQL is supported.

Initial test data

In addition to the automatic flyway migration, you can specify database scripts that are executed after the migration. Simply configure them via @Flyway(testDataScripts = {...}).

Using a custom docker image

If you want to use a custom docker image for your database, specify it via @Flyway(dockerImage = "").

Why is Testflight.Space so fast?

Testflight.Space does the actual migration at most once per test suite execution (That means i.e. 'once per mvn test run). Then the resulting docker image is cached and reused for every test. If you don't change your flyway scripts and your test data, Testflight.Space will even reuse that image for further test executions. So as long as the database and test data does not change, the database image (with the test data) will be reused, even when you run the tests from your IDE.

testflight's People

Contributors

arnelimburg avatar rene-frerichs avatar someone47 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.