Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

183 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flyway-test-extensions

flyway-test-extension logo

Test extensions for the Flyway project

For feature of Flyway see Flyway Db Org Page

Version 3.0 Released

2014-06-23 flyway-test-extensions version 3.0 released.

Version number 3.0 are used to show the dependency to Flyway version 3.0.

See also Release Notes

Central maven repository under http://search.maven.org/#search|ga|1|flyway-test-extensions contains all projects jar.

Project

This extension give the possibility to reset and/or fill the database with defined content.
With this precondition each test had reproducible database start point.

  • Annotation support FlywayTest for database unit testing. Use Flyway feature.
    • clean - execution of flyway task clean
    • init - execution of flyway task init
    • migrate - execution of flyway task migrate
  • Annotation can be used at
    • each test class (once per test case)
    • each test method
  • Samples projects to use annotation inside a unit testing environment
  • Additional project supports a DBUnit annotation use together with FlywayTest DBUnitSupport. A usage example you will find at UsageFlywayDBUnitTest.

How to use it

The flyway test extension are available at Maven Central.

For a detail usage description see the UsageFlywaySpringTest usage page. Attention: this version has a dependency to spring 4. If spring 3 support is needed use flyway-spring3-test instead.

  • add dependency to flyway-spring-test to your Mavan pom file
    <dependency>
       <groupId>org.flywaydb.flyway-test-extensions</groupId>
       <artifactId>flyway-spring-test</artifactId>
       <version>3.0</version>
       <scope>test</scope>
    </dependency>
  • Extend your test class with the Spring test runner annotation.
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations = {"/context/simple_applicationContext.xml" })
    @TestExecutionListeners({DependencyInjectionTestExecutionListener.class, 
                             FlywayTestExecutionListener.class })
  • add the @FlywayTest annotation on each class or method were you need a clean database. You can also use the anntotation on class basis and every test method in the class where a clean database is also needed.
    // usage as once per class
    @FlywayTest
    public class Spring4JUnitTest 

    // another TestClass
    
    public class Spring4JUnitTest {
    
    // usage as per test method
    @Test
    @FlywayTest
    public void testMethod() { 

Project depend on

Notes

  • The project depends on flyway version 3.0
  • The project will be supported until the extension will be integrated into the flyway project.
  • The project depends on Spring version 4.x (see flyway-spring4-test and flyway-dbunit-spring4-test)
  • The project depends on Spring version 3.1 (see flyways-swpring3-test and flyway-dbunit-spring3-test)
    • All features works with Spring version 3.x
    • It works also with Spring version 2.5.6, but you can not use all features. A example project show how to use it with Spring 2.5.6
  • At the moment the code is tested with database H2 and Oracle.
    Only the DBunit part contains database specific code.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors