springtestdbunit / spring-test-dbunit

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

How can i avoid wrong datasource. #95

Closed limeng32 closed 8 years ago

limeng32 commented 8 years ago

Hi, i am from China so may be a little strange in my word. I do a one-man project with springtestdbunit, and i had to switch from 4 datasources (volatile,dev,test and real) by maven profile. I found it`s hard to recognize the exact datasource using when i use "mvn clean test" in my module with inheritance relationships. It will be a disaster if i do dbunit test in my "real" datasource. So anyone could give me some good idea? A lot Thanks.

mzagar commented 8 years ago

Hi,

You could try one of the following:

Hope this helps.

limeng32 commented 8 years ago

Thanks mzagar, the @IfProfileValue realily work. It just deal half the problem, if my module inherited a wrong profiled jar, the right profile value just can't work. Finally I remove data source in main and use another test app.xml that have data source and include the main one to solve. By the way auto wire may be not work becouse I think spring test dbunit @datasetup annotation will run before it. Best regards.