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
4
votes
0 answers

Why does my UUID column result in a "Bad Base64 Input Character" with DBUnit?

I have a Hibernate DAO class with a UUID column, works fine when i run it on my server against mySQL. However, i am trying to write an integration test using DBUnit, and i get a strange error message: "Bad Base64 input character at 4:…
Mathias
  • 3,879
  • 5
  • 36
  • 48
4
votes
3 answers

Unable to install phpunit ,Conclusion: don't install phpunit/phpunit 6.5.8

I have php 7.0.29 version installed on my vagrant setup on windows 10. When I run following command composer require --dev phpunit/phpunit I get errors as mentioned Using version ^6.5 for phpunit/phpunit ./composer.json has been updated Loading…
Mukesh
  • 7,630
  • 21
  • 105
  • 159
4
votes
1 answer

PHPUnit database testing with DBUnit extension

Hey, Im new to the whole PHPUnit and would like to test my code against a database, from reading all the stuff on the phpunit.de, it talks about a seed.xml file. Can someone just clarify, do i need to create this dataset myself using a mysqldump…
phpNutt
  • 1,529
  • 7
  • 23
  • 40
4
votes
1 answer

Alternative for @Autowired in Spring, which won't initialize the bean before test class setup

I have a Spring Bean class which communicates with the DB, and I'm working on writing a test case for it. I'm making use of DbUnit which sets up an in-memory database (based on extending a base DbUnit class) using JUnit Annotation @Before. The issue…
abdelrahman-sinno
  • 1,157
  • 1
  • 12
  • 33
4
votes
2 answers

Spring Test DBUnit: Unable to load dataset from file

I'm trying to use Spring Test DBUnit for running an integration test that checks if a DAO's services are running correctly. For two similar entities, I was able to create tests that run OK, but for this particular entity, the test can't run…
jmm
  • 1,044
  • 2
  • 12
  • 38
4
votes
3 answers

DBUnit & Postgres UUID Primary Key

I am trying to use DBUnit to run integration tests, however I am finding myself unable to insert the primary key columns, which obviously will not work with foreign keys referencing the primary key later on in the file. For example, I have the…
user372743
4
votes
4 answers

Integration testing - Hibernate & DbUnit

I'm writing some integrations tests in JUnit. What happens here is that when i run all the tests together in a row (and not separately), the data persisted in the database always changes and the tests find unexpected data (inserted by the previous…
Mark
  • 67,098
  • 47
  • 117
  • 162
4
votes
1 answer

mysqldump xml format and dbunit expected xml format in phpunit test in php

I am working in phpunit testing with dbunit. This is my first time testing in php. I am creating xml by this command: mysqldump --xml -t -u username -p database > seed.xml After that as per doc xml should be in below format:
Awlad Liton
  • 9,366
  • 2
  • 27
  • 53
4
votes
1 answer

Corrected table name message in dbunit

dbunit data has been populated with lower case table names as per schema definition. Why do you get a corrected table warning every time, I run the scripts for all databases (h2, mysql ..) [INFO] [dbunit:operation {execution: seed data}] 120 [main]…
Joe
  • 14,513
  • 28
  • 82
  • 144
4
votes
2 answers

DbUnit does not update postgresql sequences on insert

I am using DbUnit to run some test on a postgreSql database. In order to be able to run my test, I bring the database into a well known state by repopulating the database tables before each test, running a clean insert. Therefore I use the…
Phidelux
  • 2,043
  • 1
  • 32
  • 50
4
votes
5 answers

DBunit; confusion over case sensitivity on table/column names

I'm getting this error when I start up my application Caused by: org.dbunit.dataset.NoSuchColumnException: CLIENT.ID - (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive I'm…
Jimmy
  • 16,123
  • 39
  • 133
  • 213
4
votes
2 answers

Ignore columns in ExpectedDataSet (dbunit)

How can I ignore the comparison of some columns using ExpectedDataSet annotation? I use dbunit API.
Dali
  • 135
  • 2
  • 13
4
votes
1 answer

DbUnit H2 in memory db with Spring and Hibernate

Hi I'm trying a little POC with JPA and unit test to verify that the DB schema is created. I'm working with H2 DB and I set to Hibernate create the schema from the entities, but when DbUnit tries to initialize the DB from a dataset I always get a…
Arless
  • 422
  • 1
  • 6
  • 11
4
votes
1 answer

How to extract a subset of a database into a dbunit file using a sql query?

Why ? I have got a big Oracle table. I would like to test some DAO methods. To do so, I use dbunit. Problem I would like to extract a subset of an existing database as a dbunit flat xml file using a sql query. Example of query : Select …
Jerome Cance
  • 8,103
  • 12
  • 53
  • 106
4
votes
2 answers

Wrap an entire DBUnit/JUnit Test under a single transaction

I have searched around but have been unsuccessful in determining whether the following approach is possible / good practice. Basically what I would like to do is the following: Create JUnit Tests which use DBUnit to initialize the data. Run multiple…
Matt
  • 177
  • 2
  • 13