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

NoSuchColumnException from 1.1.0 to 1.2.1 #77

Open gionn opened 9 years ago

gionn commented 9 years ago

I've upgraded spring-test-dbunit from 1.1.0 to 1.2.1, and I am getting this kind of errors for some datasets that doesn't contains all the fields of a specific table.

org.dbunit.dataset.NoSuchColumnException: clou_desire_user.COMPANY -  (Non-uppercase input column: company) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
    at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117)
    at org.dbunit.dataset.AbstractTable.getColumnIndex(AbstractTable.java:78)
    at org.dbunit.dataset.DefaultTable.getValue(DefaultTable.java:197)
    at org.dbunit.dataset.CompositeTable.getValue(CompositeTable.java:119)
    at org.dbunit.operation.InsertOperation.equalsIgnoreMapping(InsertOperation.java:143)
    at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:162)
    at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
    at com.github.springtestdbunit.DbUnitRunner.setupOrTeardown(DbUnitRunner.java:194)
    at com.github.springtestdbunit.DbUnitRunner.beforeTestMethod(DbUnitRunner.java:66)
    at com.github.springtestdbunit.DbUnitTestExecutionListener.beforeTestMethod(DbUnitTestExecutionListener.java:186)
    at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:249)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:72)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

Any suggestions?

mandado commented 8 years ago

I have same problem.

OleksiiChumak commented 8 years ago

I have the same problem.

philwebb commented 8 years ago

Sounds like a core DBUnit issue. Perhaps you can share some code that demonstrates the issue?

djselzlein commented 7 years ago

I´m having the same issue when migrating from 1.2.0 to 1.3.0. Has anyone been able to solve it?

djselzlein commented 7 years ago

I found a solution. When I use the annotation @DatabaseSetup on my test methods I get the error as reported in this issue (NoSuchColumnException). But this only occurs when I have an array of XML files in the 'value' annotation property.

When I tried to separate my XML builders into different @DatabaseSetup annotations, all of them inside a @DatabaseSetups it started to work again. I hope it helps, let me know if my explanation is blurry.

gionn commented 7 years ago

Yeah, we are plenty of @DatabaseSetup ( value = { "whatever.xml", "whenever.xml" } )

So this is probably a regression inside this project?

djselzlein commented 7 years ago

Unfortunately, it looks like so.

codeBud7 commented 7 years ago

This was a core DBUnit issue as @philwebb mentioned. If you update to the latest version of DBUnit <version>2.5.3</version> the problem is solved.

gvespucci commented 7 years ago

I updated DBUnit to 2.5.3, SpringTestDbUnit to 1.3.0, to workaround this issue; and used the @DatabaseSetups, and used (I'm on Java8) a series of repeatable @DatabaseSetup as mentioned by @djeisonselzlein; but at this point my XML datasets are not loaded anymore... I feel like having a too short blanket here... :|

djselzlein commented 7 years ago

@gvespucci according to @codeBud7 you wouldn't need to use multiple @DatabaseSetup anymore, @DatabaseSetup with multiple values should work. Still, what do you mean by "datasets are not loaded anymore"? Are you getting an exception or something? If not, check what you are using as DatabaseOperation.

gvespucci commented 7 years ago

Let me say that I'm using TestNG and not JUnit, because this could be important :) I was meaning that the datasets are silently ignored... In any case, I've always used the default DatabaseOperation.CLEAN_INSERT in my @DatabaseSetup annotations. I'm in the following bad situation here: if I use the single @DatabaseSetup with an array of XML file paths, the datasets are loaded correctly but I receive the NoSuchColumnExpection; if I use the series of @DatabaseSetup, no data are uploaded in the database. As additional details, I can add I'm using the @DatabaseSetup annotations at class level, and I'm extending the org.springframework.test.context.testng.AbstractTestNGSpringContextTests. Thank you.

djselzlein commented 7 years ago

I would need your piece of code in order to understand your problem better. Could you post it to StackOverflow maybe?

sherrif10 commented 3 years ago

@gionn @gvespucci did anyone got this resolved please am getting the same problem

gionn commented 3 years ago

still using v1.1.0 and actively looking for an alternative :skull:

luishdezortega commented 1 year ago

Hello, I am facing the same problem. I have found an alternative to update the version to solve it.

gvespucci commented 1 year ago

@sherrif10 To be honest, this is not my core business anymore 😅 . I apologize. All the best.