Questions tagged [spring-test-dbunit]

Spring DBUnit provides integration between the Spring testing framework and the popular DBUnit project.

Spring DBUnit provides integration between the Spring testing framework and the popular DBUnit project. It allows you to setup and teardown database tables using simple annotations as well as checking expected table contents once a test completes.

91 questions
3
votes
0 answers

DbUnit row order in data verification

I'm trying to do a DbUnit data verification in an insert operation between a table in XML file and a table in the database. I´ve sorted both tables by "ID" and then ignored it in the comparison because its value is auto incremental and I don´t know…
3
votes
0 answers

Support for Sequence in DBUnit

We are in the process of analyzing DBUnit for data driven unit testing. We were able to export oracle DB tables to a flat xml dataset using the code below and use the generated dataset as an input to our junit testing. // partial database…
shatk
  • 465
  • 5
  • 16
2
votes
0 answers

Verify only new entry or updated entry in table with dbunit

Hi I faced with a problem or verification of datasets in dbunit. Lets imagine I have such a table //initial-dataset.xml
Aliaksei Bulhak
  • 6,078
  • 8
  • 45
  • 75
2
votes
1 answer

DBUnit insists on inserting null for unspecified values, but I want the DB default value to be used

I'm having this problem with DBUnit causing a SQL insert error. Say I have this in my dbunit testdata.xml file: I have a table like this (postgres) myschema.mytable has an id, value1, value2,…
MTR
  • 1,411
  • 4
  • 14
  • 23
2
votes
1 answer

Problems using dbunit with Spring (without spring-test-dbunit)

I'm trying to use dbunit to test my DAOs. We use Spring in a version that is not compatible with spring-test-dbunit. I can't autowire my dao beans into my test class, because then I would have to use @RunWith(SpringJUnit4ClassRunner.class) which…
Pascal Petruch
  • 344
  • 3
  • 16
2
votes
1 answer

How can I execute first @After void after() from junit and then @ExpectedDatabase from db-unit?

I want to test a database view and I use db-unit to insert data into tables which are used by tested view and expected values form view is done by db-unit, but this view use some data form another view which I want to mock, I have done some a script…
2
votes
1 answer

DBUnit error : NoSuchTableException

I tried to write Unit tests for my database Services according to this example (https://github.com/21decemb/spring-boot-dbunit-example). I created dataset and test example. After I run the test I recived: org.dbunit.dataset.NoSuchTableException:…
2
votes
1 answer

org.dbunit.dataset.NoSuchTableException: localized_values

I am trying to using spring test dbunit. https://springtestdbunit.github.io/spring-test-dbunit/ As I am using spring 4.1.x I decided to use version 1.2.1 for spring-test-dbunit and 2.5.2 for core dbunit. Originally I used plain dbunit and it worked…
lapots
  • 12,553
  • 32
  • 121
  • 242
2
votes
0 answers

DBUnit bytea insert

I'm using Spring Oauth and I'm trying to insert test data into oauth_client_token table (client side Spring Oauth 2). When I look at the bytecode for Spring Oauth's JdbcClientTokenService.saveAccessToken, I'm seeing this: jdbcTemplate.update( …
Dean
  • 887
  • 4
  • 16
  • 42
2
votes
0 answers

Precedence of @DatabaseSetup and @BeforeTransaction Spring DBUnit and Spring Transaction

I have a JUnit test where I am using Spring Test DBUnit and Spring declarative transaction management. If I tag a test method with @Transactional (which will utilize the @BeforeTransactional to verify database state) and also with @DatabaseSetup (to…
adamconkey
  • 4,104
  • 5
  • 32
  • 61
2
votes
0 answers

Spring DBUnit insert dataset before autowiring

I have some beans that query the database in a @PostConstruct method. Thus, I need the database to be ready before autowiring occurs. Is this possible? This is my test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations =…
felipe_gdr
  • 1,088
  • 2
  • 11
  • 27
2
votes
0 answers

DBUnit cannot import data into H2 DB by xml file

I'm doing DBUnit 2.5.0 and h2 db, a memory database 1.4.180 for TestNG. I use DBUnit to export dataschema from db (PostgreSQL). Then I use this xml file for H2 DB, but whenever I run testNG, it thrown an exception:…
Phong Nguyen
  • 277
  • 4
  • 16
2
votes
2 answers

Rollback error in using Spring DBUnit, Spring Data and embedded H2 database

I've been stuck in a curios error. I have a small DBUnit Test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:spring/testApplicationContext.xml") @Category(Integrationtest.class) @TestExecutionListeners({ …
bonaly
  • 71
  • 11
2
votes
1 answer

SprigngTestDBUnit. How to ignore row order when comparing expected and actual datasets

I'm using com.github.springtestdbunit to conduct persistence tests on my DAO layer. The problem is that i don't know in which order data will be saved to database, so i need to ignore row order when comparing expected and actual datasets. Basically…
stanislav.chetvertkov
  • 1,620
  • 3
  • 13
  • 24
2
votes
2 answers

Escaping reserved database keywords with spring-test-dbunit

How do I escape SQL Server keywords using Spring-test-dbunit framework? In my @DatabaseSetup("sampleData.xml") file, I have a table called File which is a reserved keyword in SQL Server. In order for the queries to run successfully on SQL Server,…
nmc
  • 8,724
  • 5
  • 36
  • 68