Ride the database in JUnit tests
with Database Rider
Mikalai Alimenkou
@xpinjection
https://t.me/xpinjection_channel
https://xpinjection.com
Ride the database in JUnit tests with Database Rider
Telegram channel
https://t.me/xpinjection_channel
Disclaimer
This talk is based on
personal experience
Universal formula of success
good tools
OUR FOCUS TODAY!
Looking for motivation?
https://www.youtube.com/watch?v=RanIHsirGFg
https://jeeconf.com/program/test-driven-spring-boot-
applications/
Some words about test data management
https://seleniumcamp.com/talk/bro-manage-test-data-like-a-pro/
Don’t forget about practice!
This story has been started a
long time ago with Unitils…
I was Unitils fan for many years…
https://www.slideshare.net/alimenkou/java-unit-testing-with-unitils
Every story has an end 
2014
Database Rider is a nice replacement
This project aims for bringing
DBUnit closer to your JUnit
tests so database testing will
feel like a breeze!
So you can ride the database
in your JUnit tests!
https://github.com/database-rider/database-rider
Why is it so good?
Open source with friendly contributors team
Minimal set of dependencies, pure JDBC
implementation
Simple, powerful and very flexible
Still wrapper around DBUnit with all it’s features
Integrations with JUnit 4/5, CDI and Cucumber
Advanced features like leak detection, constraints
management and datasets generation
Good documentation with many examples
Contribution is easy!
#1. Datasets management
Ride the database in JUnit tests with Database Rider
Code examples on Github
https://github.com/xpinjection/test-driven-spring-boot
Basics features summary
YAML, JSON, XML, CSV and even Excel format support
Full set of data management strategies
Ability to carefully clear database before/after test
Extended DB configuration with SQL support
before/after test
Multiple datasets could be applied
Advanced features summary
DTD/XSD could be used for datasets validation
File and live templates in IDE simplify your life
Groovy and JavaScript for smart data generation
Export datasets with @ExportDataSet or
DataSetExporter to speed up datasets creation
Powerful export with SQL queries and tables filtering
Programmatic data sets creation with DataSetProvider
and DataSetBuilder
Meta-annotations for configuration reuse
#2. Data assertions
Ride the database in JUnit tests with Database Rider
Basics features summary
Several datasets could be specified in
@ExpectedDataSet for assertion
Some columns may be ignored for datasets reuse
Regular expressions for complex assertions
Ordering by set of columns
Advanced features summary
Configurable set of Replacers to implement custom
logic (nulls, date/time shift, etc.)
Programmatic provider to generate dataset from code
Contains and equals data comparison
#3. Flexible configuration
Ride the database in JUnit tests with Database Rider
Basics features summary
Global configuration in dbunit.yml
Local configuration at class/test level with @DBUnit
Executor scope for multiple logical databases support
EntityManagerProvider rule for JPA entity manager
provider
Merging of class and test level data sets
Externalized connection management
Configurable caching
#4. Advanced features
Ride the database in JUnit tests with Database Rider
Advanced features summary
Transactions management
Flexible table filtering and ordering for data cleanup
Disabling constraints to simplify data management
Connection leak detection
CDI integration
Cucumber integration
WTF?!?
You told us this is
very simple library!
Summary and take aways
Database Rider simplifies your testing experience
You could use it for any kind of tests (unit, integration,
API, system)
Generate datasets where possible
Use full power of IDE to speed up datasets creation
Experiment with advanced features like leak detection
Contribute if your case is not covered
Resources and materials
https://github.com/xpinjection/test-driven-spring-boot - examples
from the talk
https://database-rider.github.io/database-rider/ - Database Rider
home page
https://database-rider.github.io/getting-started/ - getting started guide
https://github.com/database-rider/database-rider - project on Github
https://database-rider.github.io/database-
rider/1.7.3/documentation.pdf - current version of official
documentation
@xpinjection
https://xpinjection.com
https://t.me/xpinjection_channel

More Related Content

PPTX
Platforms, Platform Engineering, & Platform as a Product
PDF
KCD Zurich 2023 — Bridge Dev & Ops with eBPF.pdf
PDF
OpenStack DevStack Install - 2부 (Multi-nodes)
PPTX
Infrastructure as Code on Azure: Show your Bicep!
PPTX
Azure Bicep for Developers
PPTX
DevOps on AZURE
PDF
Manual basis sap_r3
PDF
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
Platforms, Platform Engineering, & Platform as a Product
KCD Zurich 2023 — Bridge Dev & Ops with eBPF.pdf
OpenStack DevStack Install - 2부 (Multi-nodes)
Infrastructure as Code on Azure: Show your Bicep!
Azure Bicep for Developers
DevOps on AZURE
Manual basis sap_r3
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링

What's hot (20)

PPTX
Azure DevOps
PPTX
Enterprise Service Bus y API Managers
PDF
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
PDF
CI/CD for Microservices Best Practices
PPSX
CI-CD Jenkins, GitHub Actions, Tekton
PPTX
Rancher and Kubernetes Best Practices
PPTX
Introduction to Container Storage Interface (CSI)
PPTX
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
PDF
QGIS 2.8: Classificação de Campos com Python
PPT
PDF
Continuous Integration With Jenkins
PPTX
Azure Functions Real World Examples
PDF
쿠버네티스 기반 PaaS 솔루션 - Playce Kube를 소개합니다.
PDF
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
PPTX
Struktur kontrol percabangan
PPTX
Apigee Products Overview
PDF
Integrating with the SAP Hybris Architecture: From Reference to Real World
PDF
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Azure DevOps
Enterprise Service Bus y API Managers
CI CD Pipeline Using Jenkins | Continuous Integration and Deployment | DevOps...
CI/CD for Microservices Best Practices
CI-CD Jenkins, GitHub Actions, Tekton
Rancher and Kubernetes Best Practices
Introduction to Container Storage Interface (CSI)
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
QGIS 2.8: Classificação de Campos com Python
Continuous Integration With Jenkins
Azure Functions Real World Examples
쿠버네티스 기반 PaaS 솔루션 - Playce Kube를 소개합니다.
[오픈소스컨설팅]Docker기초 실습 교육 20181113_v3
Struktur kontrol percabangan
Apigee Products Overview
Integrating with the SAP Hybris Architecture: From Reference to Real World
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Ad

Similar to Ride the database in JUnit tests with Database Rider (13)

PPTX
Testing database content with DBUnit. My experience.
PPTX
Bro, manage test data like a pro! [QA Fest 2018]
ODP
DbSetup
PPTX
Bro, manage test data like a pro!
PPT
Automated Testing with Databases
PPTX
TDD for DB integration
PPTX
In Memory Unit Testing with Apache DbUnit
ODP
Presentation Unit Testing process
PDF
Database testing tutorial
PPTX
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
PDF
A data driven etl test framework sqlsat madison
PDF
JUnit5 Custom TestEngines intro - version 2020-06
PDF
Database Testing: A Detailed Guide
Testing database content with DBUnit. My experience.
Bro, manage test data like a pro! [QA Fest 2018]
DbSetup
Bro, manage test data like a pro!
Automated Testing with Databases
TDD for DB integration
In Memory Unit Testing with Apache DbUnit
Presentation Unit Testing process
Database testing tutorial
Evaluating Test Driven Development And Parameterized Unit Testing In Dot Net ...
A data driven etl test framework sqlsat madison
JUnit5 Custom TestEngines intro - version 2020-06
Database Testing: A Detailed Guide
Ad

More from Mikalai Alimenkou (20)

PPTX
Rise and fall of Story Points. Capacity based planning from the trenches.
PPTX
Static analysis tools as the best friend of QA
PPTX
Modern CI/CD in the microservices world with Kubernetes
PPTX
Saga about distributed business transactions in microservices world
PPTX
Effectiveness tips from Kubernetes trenches by Captain Obvious
PPTX
Wastful waste or why everything is so slow in development
PPTX
Hexagonal architecture with Spring Boot
PPTX
Wastful waste or why everything is so slow in development
PPTX
DevOps checklist or how to understand where is your team in DevOps landscape ...
PPTX
DevOps checklist or how to understand where is your team in DevOps landscape
PDF
Практические трудности в разработке Медкарты для целой страны
PPTX
Hexagonal architecture with Spring Boot [EPAM Java online conference]
PPTX
Agile antipatterns: review after 10 years of practice
PPTX
Hexagonal architecture with Spring Boot
PPTX
Бытовая классификация тестировщиков с точки зрения разработчика
PPTX
Code Review tool for personal effectiveness and waste analysis
PDF
Funny stories and anti-patterns from DevOps landscape
PPTX
Developer + tester = quality++
PPTX
Continuous improvements of developer efficiency with modern IDE
PPTX
Design patterns in test automation
Rise and fall of Story Points. Capacity based planning from the trenches.
Static analysis tools as the best friend of QA
Modern CI/CD in the microservices world with Kubernetes
Saga about distributed business transactions in microservices world
Effectiveness tips from Kubernetes trenches by Captain Obvious
Wastful waste or why everything is so slow in development
Hexagonal architecture with Spring Boot
Wastful waste or why everything is so slow in development
DevOps checklist or how to understand where is your team in DevOps landscape ...
DevOps checklist or how to understand where is your team in DevOps landscape
Практические трудности в разработке Медкарты для целой страны
Hexagonal architecture with Spring Boot [EPAM Java online conference]
Agile antipatterns: review after 10 years of practice
Hexagonal architecture with Spring Boot
Бытовая классификация тестировщиков с точки зрения разработчика
Code Review tool for personal effectiveness and waste analysis
Funny stories and anti-patterns from DevOps landscape
Developer + tester = quality++
Continuous improvements of developer efficiency with modern IDE
Design patterns in test automation

Recently uploaded (20)

PDF
Consumable AI The What, Why & How for Small Teams.pdf
PPT
Geologic Time for studying geology for geologist
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Five Habits of High-Impact Board Members
PDF
STKI Israel Market Study 2025 version august
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
Flame analysis and combustion estimation using large language and vision assi...
PPTX
Chapter 5: Probability Theory and Statistics
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Hindi spoken digit analysis for native and non-native speakers
Consumable AI The What, Why & How for Small Teams.pdf
Geologic Time for studying geology for geologist
A review of recent deep learning applications in wood surface defect identifi...
Enhancing emotion recognition model for a student engagement use case through...
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Final SEM Unit 1 for mit wpu at pune .pptx
OpenACC and Open Hackathons Monthly Highlights July 2025
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Five Habits of High-Impact Board Members
STKI Israel Market Study 2025 version august
UiPath Agentic Automation session 1: RPA to Agents
Flame analysis and combustion estimation using large language and vision assi...
Chapter 5: Probability Theory and Statistics
A contest of sentiment analysis: k-nearest neighbor versus neural network
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
The influence of sentiment analysis in enhancing early warning system model f...
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
CloudStack 4.21: First Look Webinar slides
Hindi spoken digit analysis for native and non-native speakers

Ride the database in JUnit tests with Database Rider