Presentation is loading. Please wait.

Presentation is loading. Please wait.

Effective Test Driven Database Development Gojko Adzic twitter.com/gojkoadzic.

Similar presentations


Presentation on theme: "Effective Test Driven Database Development Gojko Adzic twitter.com/gojkoadzic."— Presentation transcript:

1 Effective Test Driven Database Development Gojko Adzic twitter.com/gojkoadzic

2 Database somehow always sticks out

3 Lots of teams struggle with Database testing... Bad tools Inherently hard to test Changes are persistent Attitude of DB Specialists

4 Full build with all integration tests is the only thing you can really trust... but it is not the most practical thing to run all the time

5 DB management Dedicated instances for developers are best One development DB can also work ok Build + n*integrations must always be separate

6 Don't count on the DB being empty Tests will be much more effective if they can ignore trash

7 Generate the glue code and bring the two worlds closer together

8 Don't fight against database features, use them! Run tests in transactions!

9 Isolate non-transactional tests and run them overnight

10 Do not depend on the order of test execution

11 Prepare everything you need for an isolated test

12 Prepare everything you need... Known state of small development databases  Link to files  Trash and restore DB Start with a clean DB and Load data with DbUnit Set up data for a specific test and roll back later Ideally don't suppose that the DB is empty

13 ORM is not magic!

14 DBFIT: Test Driven DB Development Made Easy FIT+FitNesse+DB Fixtures

15 Why DbFit? Manipulate data in a relational model Provides all the plumbing  Transaction management  Smart features based on meta-data  Parameter mapping  “wizards” for regression tests Because it runs inside FitNesse, already integrated with a lot of other tools/libraries

16 Use DbFit to: Write and execute DB Unit tests Prepare/verify Java or.NET integration tests .NET: Sql Server, Oracle, (DB2)‏  Java: Mysql, Oracle, (DB2, SQL Server, Derby)‏

17 Simple commands Execute procedure Query Execute Insert Update

18 FitNesse symbols directly mapped to bind variables Retrieve auto-generated keys and use them directly > available in Java as well Already mapped to bind variables

19 Advanced features Inspect queries, tables or procs to automatically generate test tables and regression tests Store and compare queries Standalone mode for full control

20 DbFit 2.0 Upcoming release in April  Support for command timeouts  Better architecture, more flexible for different test runners  Integration with Trinidad  Support for Db2, Derby, HSQL

21 Image credits

22


Download ppt "Effective Test Driven Database Development Gojko Adzic twitter.com/gojkoadzic."

Similar presentations


Ads by Google