Questions tagged [dbunit]

DbUnit is a JUnit extension targeted at database-driven projects that, among other things, puts your database into a known state between test runs.

DbUnit is a JUnit extension targeted at database-driven projects that, among other things, puts your database into a known state between test runs.

614 questions
8
votes
3 answers

Reset sequence in DBUnit?

I want to reset the Database AND sequences after each test in Java+DBUnit/. I've seen this question but doesn't have the code solution I am struggling to get. How to use Oracle Sequence Numbers in DBUnit?
Chexpir
  • 1,876
  • 18
  • 33
7
votes
2 answers

Using DbUnit with tables which do not have primary keys

I'm attempting to set up my unit testing environment to use DbUnit. I'm having a few problems as the tables which I am attempting to control do not have primary keys. I have been getting a org.dbunit.dataset.NoPrimaryKeyException. I have followed…
mip
  • 1,886
  • 8
  • 26
  • 32
7
votes
3 answers

DBUnit not cleaning and insert the database after every method, so test are not independent

I have a test for a DAO class, I use DBUnit to create and populate the database (using an in-memory derby). I am in problems when testing the dao update method because it modify the data and then the other test fails. As all of us know a test should…
ERNESTO ARROYO RON
  • 992
  • 1
  • 9
  • 22
7
votes
4 answers

DB Unit Testing framework?

In my project, I've used spring, jpa with PostgreSQL DB, I've lots of table in DB and I need to have Unit testing of all of them. Is there any framework which just rollback all the transactions after each test finished so every test will have…
SmartSolution
  • 2,320
  • 5
  • 37
  • 49
7
votes
0 answers

Alternative to the now-abandoned dbunit extension?

So I can test code that uses a database using PHPUnit, I just installed the DbUnit extension using Composer, and I get the following message: Package phpunit/dbunit is abandoned, you should avoid using it. No replacement was suggested. I've seen…
Dave Hollingworth
  • 3,670
  • 6
  • 29
  • 43
7
votes
2 answers

org.dbunit.dataset.NoSuchColumnException

I'm getting the following error when I run my tests: org.dbunit.dataset.NoSuchColumnException: myTable.MYFIELD - (Non-uppercase input column: myfield) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive. at…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
7
votes
2 answers

Hibernate Search doesn't index/reindex entities

I'm trying to use Hibernate Search in my project (writing tests right now using junit + dbunit), but searching query doesn't return any results. I worked on this yesterday and got to conclusion that problem is Hibernate Search doesn't work well with…
Plebejusz
  • 3,332
  • 2
  • 19
  • 26
7
votes
1 answer

DbUnit fails to clean-insert: foreign key constraint

I'm asking and answering this question for future reference, because I think I've found a decent solution to a common problem with DbUnit. I hope it helps out someone, somewhere down the line. I'm using DbUnit 2.5.0 and TestNG 6.8.8. My use case is…
blagae
  • 2,342
  • 1
  • 27
  • 48
7
votes
4 answers

How do I reference a file that is placed in the WEB-INF folder when using Arquillian?

I am using maven and the standard directory layout. So I have added a testdata.xml file in the src/test/resources folder, and I also added it as: .addAsWebInfResource("testdata.xml", "testdata.xml") in the deployment method, and I have confirmed…
LuckyLuke
  • 47,771
  • 85
  • 270
  • 434
6
votes
2 answers

Getting DbUnit to Work with Hibernate Transaction

I'm having problem trying to push changes made within a Hibernate transaction to the database for DbUnit to work properly in my test case. It seems like DbUnit is not seeing the changes made by Hibernate because they are not committed at the end of…
limc
  • 39,366
  • 20
  • 100
  • 145
6
votes
3 answers

Log Output in DBUnit

I feel that this is something I could easily figure out but I'm having a hard time finding information on how to change the log level of DBUnit. Can anyone solve this problem for me?
KevinO
  • 970
  • 2
  • 13
  • 31
6
votes
3 answers

DbUnit and JSON column type support

I'm wondering what's the best possible way to make DbUnit work with MySQL's JSON(B) type columns? We do have such columns here and there and whenever I am trying to feed the test data from XML file via @DatabaseSetup I get the NoSuchColumnException…
ADi3ek
  • 645
  • 6
  • 18
6
votes
1 answer

dbUnit support for Postgresql Array

I'm writing some Unit tests for a database component. For this I use a dedicated test database (Postgresql, same as the production database) and dbUnit. Now i would like to create an XML dump of my entire test database. I currently use the code from…
6
votes
1 answer

DBUnit error - missing one the following beans: [dbUnitDatabaseConnection, dataSource]

I'm trying to use DBUnit with multiple databases loading from different configuration files (different projects). In my Foo @Configuration file I've the following bean: @Bean(name="dataSourceFoo") public DataSource dataSourceFoo() { …
bsferreira
  • 1,189
  • 5
  • 14
  • 27
6
votes
1 answer

DBUnit Boolean value

After learning SpringBoot, I wanted go further to handle integration tests using (DBUnit and SpringTestDBUnit). Throughout the process, everything was going well until I came across setting values for boolean datatyped columns on the dataset.…
David B
  • 3,269
  • 12
  • 48
  • 80
1 2
3
40 41