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
1
vote
1 answer

Loading data into an in-memory database using spring-test-dbunit

I'm trying to set up some integration tests for a java spring application. I followed the instructions (https://github.com/ppodgorsek/spring-test-dbunit) but I can't seem to get things working. I can verify that the tables are getting created and…
pbuchheit
  • 1,371
  • 1
  • 20
  • 47
1
vote
0 answers

Is There anyway i can use Dbunit with Junit5 while being in Spring 4?

am trying to migrate from Junit4 to Junit5 knowing that am working with Spring Mvc , version 4.3.5 and i wanna know if there s someway to work with dbUnit for my class Repository I did my research and the last version of dependency for Dbunit which…
1
vote
1 answer

How to prevent data deletion when using DBUnit

I use Spring Boot with liquibase. The problem is that when there is already data in a specific table in the database and I try to add more data to this table in DBUnit tests, then DBUnit deletes all the data and inserts only its own data. I will…
FreeOnGoo
  • 868
  • 1
  • 8
  • 26
1
vote
1 answer

unit test in DAO's save method

I wrote a unit test to test the save method of DAO, I'm sure my save method works, however, when I running my unit test it ran into this error: junit.framework.ComparisonFailure: row count (table=RECONCILIATION_OBJECT_HANDLER) expected:<[4]> but…
NullPointer
  • 412
  • 7
  • 17
1
vote
1 answer

SpringTest DBUnit: Failed to Load Application Context cause by Unable to locate keycloak.json

Hi I am new to spring mvc and would like to create an integration test using spring test dbunit but I am encountering an error. Keycloak.json file was not found but it exists under the test folder. The path of keycloak.json is also indicated in the…
1
vote
0 answers

Spring Test DBUnit does not create a dataset

I use SpringBoot, Spring Test DBUnit. I wrote a test: ShortenerAppTest: @TestPropertySource(locations = "classpath:application-test.properties") @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes =…
RAS
  • 197
  • 5
  • 18
1
vote
1 answer

IncompatibleClassChangeError when testing SpringDataJpa using DbUnit

It seems this situation appears before, and was asked& answered, but situation is changed because of updated versions... I tried my Spring DBUnit test with default configuration (connecting to h2db, i've checked, h2db is used correctly): …
Sergii
  • 7,044
  • 14
  • 58
  • 116
1
vote
2 answers

DBUnit order for dataset

I have the following quite strange dataset for DBUnit:
Bizon4ik
  • 2,604
  • 4
  • 20
  • 46
1
vote
1 answer

the object is already closed in integration test

I am using spring-test-dbunit to run integration tests. I want to use different datasets inside one class. I have BaseRepositoryTest class @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(value = { …
lapots
  • 12,553
  • 32
  • 121
  • 242
1
vote
1 answer

DBUnit testcase scope

I am looking for scope of DBUnit TestCase. Can Spring DAO Layer methods be tested using using DBUnit? My perception is that JUnit should be used for Spring DAO Layer test cases. DBUnit test cases scope would be to verify Database Table Structure and…
1
vote
1 answer

How to populate an Oracle TIMESTAMP WITH ZONE field using Dbunit FlatXmlDataSet

I am trying to setup data for a DB unit test by populating a table which has columns of type TIMESTAMP(6) WITH TIME ZONE as follows: But I keep getting…
1
vote
1 answer

TransactionRequiredException with DBUnit and Spring Data JPA

I am developing a Spring Boot application using Spring Data JPA. I have a JpaRepository that works fine in normal executions but when I try to test it using DBUnit I get the following…
1
vote
2 answers

How to ignore existing elements of tables when testing database with DBUnit

I'm using DBUnit for testing my database. My database is not empty, So what I want is to ignore existing elements and to test just data inserted by my test. This is an example of how test is run : 1- Table contains 10 elements 2- DBUnit insert some…
Marouane
  • 21
  • 8
1
vote
1 answer

Spring test + DBUnit Unable to load DataSet

I am trying to write an integration test within my Spring Boot application. I have problems getting the setup configuration right. The following Exception is thrown: java.lang.IllegalArgumentException: Unable to load dataset from "sampleData.xml"…
user1651804
  • 55
  • 2
  • 8
1
vote
1 answer

Hibernate and Spring Data with Spring DBUnit on HSQLDB - Unable to delete due to foreign key constraint

I'm using Hibernate and Spring Data to model a very simple domain: @Entity public class User implements Serializable { private static final long serialVersionUID = -5501812656863255674L; @Id private String emailAddress; @Column …
chrishern
  • 302
  • 2
  • 6
  • 15