Slide 1

Slide 1 text

DAO testing with Spring Test DBUnit Lightning Talk @ JavaBin Sørlandet June 8 2012

Slide 2

Slide 2 text

Spring Test DBUnit ● Integration between Spring Test and DBUnit ● http://github.com/springtestdbunit/

Slide 3

Slide 3 text

The point? Makes DAO testing with actual data very easy!

Slide 4

Slide 4 text

Our current solution

Slide 5

Slide 5 text

Meet Mr. Bean and his DAO

Slide 6

Slide 6 text

Meet Mr. Bean and his DAO

Slide 7

Slide 7 text

Meet Mr. Bean and his DAO

Slide 8

Slide 8 text

Configuration

Slide 9

Slide 9 text

Configuration HSQ LDB!

Slide 10

Slide 10 text

… and the test case

Slide 11

Slide 11 text

… and the test case

Slide 12

Slide 12 text

The data set XML file!

Slide 13

Slide 13 text

@DatabaseSetup

Slide 14

Slide 14 text

Test case with @DatabaseSetup

Slide 15

Slide 15 text

Supports both class and method level

Slide 16

Slide 16 text

Can also be used with JUnit @Rules

Slide 17

Slide 17 text

@DatabaseTearDown

Slide 18

Slide 18 text

@ExpectedDatabase

Slide 19

Slide 19 text

Using @Transactional? No worries – it's just a small modification to @TestExectutionListener

Slide 20

Slide 20 text

● vs

Slide 21

Slide 21 text

Code examples: http://github.com/jarannilsen/springtestdbunit-demo

Slide 22

Slide 22 text

Thank you!