Executing module schema changes for unit testing


While working on HFE REST module, we’ve (@piyush9620, @ivange94) encountered an issue. Here’s what we tried so far:

  1. The module extends HFE and uses REST module to restify HFE. In order to set up unit tests, we created a RestControllerTest class extending BaseModuleWebContextSensitiveTest.

  2. We created an XML file HtmlformentryRestTestService-initialData.xml and added a couple of htmlformentry_html_form records, and put in src/test/resources/include

  3. Next, we call initializeInMemoryDatabase() and executeDataSet(DATA_XML) methods in @Before method.

  4. When executeDataSet(DATA_XML) is executed, we are getting TableNotFoundException on html_form table

As a quick workaround, we are executing a CREATE TABLE statement before executeDataSet(DATA_XML), but I think the right solution would be to upgrade the test DB by calling liquibase upgrade() method. Any clues?

Does this help? dataset error "NO such Table Exception"

Thanks @dkayiwa. Although we’ve changed our course, and are now gonna be using Mockito, we’ll check this out out.