James Jefferies and ShedCode Ltd

The world of James and ShedCode

Disabling Liquibase When Running Unit Tests

| Comments

If you’re running Liquibase, configured by Spring (or whatever) and you don’t want it to run it’s checks when running unit tests, you can disable it from running by setting a system property.

Whilst running a single unit test class many times, you might want to add a system set property call before any of the tests are run. Hence:

1
2
3
4
@BeforeClass
public static void switchOffLiquibase() {
  System.setProperty(Liquibase.SHOULD_RUN_SYSTEM_PROPERTY, "false");
}

Comments