springtestdbunit / spring-test-dbunit

Integration between the Spring testing framework and DBUnit
http://springtestdbunit.github.com/spring-test-dbunit/
Apache License 2.0
476 stars 238 forks source link

org.dbunit.dataset.NoSuchTableException: users #152

Open arthurdn opened 5 years ago

arthurdn commented 5 years ago

org.dbunit.dataset.NoSuchTableException: users

My test based on com.github.springtestdbunit:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestDataConfiguration.class})
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class,
    DirtiesContextTestExecutionListener.class,
    TransactionalTestExecutionListener.class,
    DbUnitTestExecutionListener.class})
public class OrderServiceTest {//...
@Test
@Rollback
@DirtiesContext
@DatabaseSetup(value = "/db.unit/beforeSaveOrder.xml")
@ExpectedDatabase(assertionMode = NON_STRICT, value =     "/db.unit/afterSaveOrder.xml")
public void save() {/****/};}

Here is hibernate.hbm2ddl.auto property from spring boot app:

hibernate.hbm2ddl.auto=create-drop

User class:

@Data
@Entity
@Where(clause = BaseConstants.BASE_MODEL_CONDITION)
@Table(name = "users", schema = BaseConstants.SCHEMA)
public class User extends BaseModel implements Serializable {/****/}

How to fix this?

Works in not test env.