SlideShare a Scribd company logo
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

What's hot (20)

PPTX
Apache Avro vs Protocol Buffers
Seiya Mizuno
 
PDF
AppiumのWebViewアプリテストの仕組みとハマりどころ
Masayuki Wakizaka
 
PDF
ぐるなびが活用するElastic Cloud
Elasticsearch
 
PDF
kyotolisp#1 LT3 美しいLispの書き方 (1)
hayato_hashimoto
 
PDF
ふつうの受託開発チームのつくりかた
Yoshitaka Kawashima
 
PDF
Spring 歴約1年初心者の Test 奮闘記
chishizu naito
 
PDF
PostgreSQL Unconference #5 ICU Collation
Noriyoshi Shinoda
 
PDF
ドメイン駆動設計サンプルコードの徹底解説
増田 亨
 
PDF
JS7 JobScheduler プレビュー
OSSラボ株式会社
 
PDF
ソフトウェアテスト入門
Preferred Networks
 
PDF
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
Yoshifumi Kawai
 
PDF
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
NTT DATA Technology & Innovation
 
PPTX
PostgreSQLモニタリング機能の現状とこれから(Open Developers Conference 2020 Online 発表資料)
NTT DATA Technology & Innovation
 
PPTX
テストで使うツールの紹介
Mineo Matsuya
 
PDF
知っておきたいSpring Batch Tips
ikeyat
 
PDF
ドメイン駆動設計 本格入門
増田 亨
 
PDF
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
onozaty
 
PPTX
OKRワークショップ - vol1.OKRとは
OKRJapan
 
PDF
DBREから始めるデータベースプラットフォーム
Insight Technology, Inc.
 
PDF
概説 テスト分析
崇 山﨑
 
Apache Avro vs Protocol Buffers
Seiya Mizuno
 
AppiumのWebViewアプリテストの仕組みとハマりどころ
Masayuki Wakizaka
 
ぐるなびが活用するElastic Cloud
Elasticsearch
 
kyotolisp#1 LT3 美しいLispの書き方 (1)
hayato_hashimoto
 
ふつうの受託開発チームのつくりかた
Yoshitaka Kawashima
 
Spring 歴約1年初心者の Test 奮闘記
chishizu naito
 
PostgreSQL Unconference #5 ICU Collation
Noriyoshi Shinoda
 
ドメイン駆動設計サンプルコードの徹底解説
増田 亨
 
JS7 JobScheduler プレビュー
OSSラボ株式会社
 
ソフトウェアテスト入門
Preferred Networks
 
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
Yoshifumi Kawai
 
Javaコードが速く実⾏される秘密 - JITコンパイラ⼊⾨(JJUG CCC 2020 Fall講演資料)
NTT DATA Technology & Innovation
 
PostgreSQLモニタリング機能の現状とこれから(Open Developers Conference 2020 Online 発表資料)
NTT DATA Technology & Innovation
 
テストで使うツールの紹介
Mineo Matsuya
 
知っておきたいSpring Batch Tips
ikeyat
 
ドメイン駆動設計 本格入門
増田 亨
 
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
onozaty
 
OKRワークショップ - vol1.OKRとは
OKRJapan
 
DBREから始めるデータベースプラットフォーム
Insight Technology, Inc.
 
概説 テスト分析
崇 山﨑
 

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

PPTX
SQL Server - High availability
Peter Gfader
 
PPTX
AI Stack on AWS: Amazon SageMaker and Beyond
Provectus
 
PPT
Sql interview-question-part-9
kaashiv1
 
PPT
Sql interview question part 9
kaashiv1
 
PPT
Ebook9
kaashiv1
 
PPT
Ebook9
kaashiv1
 
PDF
Configure Intranet and Team Sites with SharePoint Server 2013 (update May 2013)
Vinh Nguyen
 
PPTX
Techedafricademystifyingbackuprestoreinsharepoint2007 090805103250 Phpapp02
malonzo
 
PPTX
Tech Ed Africa Demystifying Backup Restore In Share Point 2007
Joel Oleson
 
PPTX
Selenium Tutorial for Beginners | Automation framework Basics
Techcanvass
 
PPTX
Test automation framework
QACampus
 
PPTX
SF Welly Back Up your org with Xero and Ausure
Anna Loughnan Colquhoun
 
PPT
Automated Testing with Databases
elliando dias
 
PPTX
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
murtazahaveliwala
 
PDF
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
flufftailshop
 
PDF
Informatica dvo training
keerthi124
 
PPTX
In Memory Unit Testing with Apache DbUnit
Mohammad Sabir Khan
 
PPT
Ebook10
kaashiv1
 
PPT
Sql interview question part 10
kaashiv1
 
PDF
Resume sailaja
SailajaPrasadMohanty
 
SQL Server - High availability
Peter Gfader
 
AI Stack on AWS: Amazon SageMaker and Beyond
Provectus
 
Sql interview-question-part-9
kaashiv1
 
Sql interview question part 9
kaashiv1
 
Ebook9
kaashiv1
 
Ebook9
kaashiv1
 
Configure Intranet and Team Sites with SharePoint Server 2013 (update May 2013)
Vinh Nguyen
 
Techedafricademystifyingbackuprestoreinsharepoint2007 090805103250 Phpapp02
malonzo
 
Tech Ed Africa Demystifying Backup Restore In Share Point 2007
Joel Oleson
 
Selenium Tutorial for Beginners | Automation framework Basics
Techcanvass
 
Test automation framework
QACampus
 
SF Welly Back Up your org with Xero and Ausure
Anna Loughnan Colquhoun
 
Automated Testing with Databases
elliando dias
 
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
murtazahaveliwala
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
flufftailshop
 
Informatica dvo training
keerthi124
 
In Memory Unit Testing with Apache DbUnit
Mohammad Sabir Khan
 
Ebook10
kaashiv1
 
Sql interview question part 10
kaashiv1
 
Resume sailaja
SailajaPrasadMohanty
 
Ad

More from Mikalai Alimenkou (20)

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

Recently uploaded (20)

PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Digital Circuits, important subject in CS
contactparinay1
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 

Ride the database in JUnit tests with Database Rider