How to Test Data Acces Code or Rube Goldberg:Software Developer.

Slides:



Advertisements
Similar presentations
Copyright © SoftTree Technologies, Inc. DB Tuning Expert.
Advertisements

Databases MMG508. DB Properties  Definition of a database: “A database is a collection of interrelated data items that are managed as a single unit”
Effective Test Driven Database Development Gojko Adzic twitter.com/gojkoadzic.
G O B E Y O N D C O N V E N T I O N WORF: Developing DB2 UDB based Web Services on a Websphere Application Server Kris Van Thillo, ABIS Training & Consulting.
A Comparison of Database Software CS 616 April 8, 2004 Team 7 Mandar Patankar Jonathan Cohen B. Timothy Walsh.
Cross-curricular Assignment Using your case study…
27-Jun-15 Rails. What is Rails? Rails is a framework for building web applications This involves: Getting information from the user (client), using HTML.
Presentation Outline What is JUnit? Why Use JUnit? JUnit Features Design of JUnit Downloading JUnit Writing Tests – TestCase – TestSuite Organizing The.
Software Testing & Strategies
Session-01. Hibernate Framework ? Why we use Hibernate ?
Database Development Using TDD Chris Oldwood ACCU Conference /
Air Quality Data Analysis Using Open Source Tools
Red-Green-Refactor! EclipseCon 2008 Kevin P. Taylor, Nicolaus Malnick Test-Driven Development (TDD) for Eclipse RCP.
By: Taylor Helsper.  Introduction  Test Driven Development  JUnit  TDD Example  Conclusion.
 ETL: Extract Transformation and Load  Term is used to describe data migration or data conversion process  ETL may be part of the business process repeated.
Chapter 1 Introduction Outstanding Features About This Book 1. A novel writing style is adopted to try to attract students’ or beginning programmers’ interesting.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Cloud Computing for the Enterprise November 18th, This work is licensed under a Creative Commons.
Manage Engine: Q Engine. What is it?  Tool developed by Manage Engine that allows one to test web applications using a variety of different tests to.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Using Microsoft ACCESS to develop small to medium applications on campus.
Data Administration & Database Administration
Database refactoring. For the beginning… Avoid overspecialization Application developerDatabase developer Developer Communication Cooperation Exchange.
Administrative Technology Services: Enterprise Applications
Effectively Validate Query/Report: Strategy and Tool Steven Luo Sr. System Analyst Barnes & Noble Session id:
Lecture 7 Integrity & Veracity UFCE8K-15-M: Data Management.
Software testing Main issues: There are a great many testing techniques Often, only the final code is tested.
Database Change Management One solution to an often complex problem Kevin Hurwitz Headspring Systems
PHP Features. Features Clean syntax. Object-oriented fundamentals. An extensible architecture that encourages innovation. Support for both current and.
Effective Test Driven Database Development Gojko Adzic
Reactive Database Access in Scala with Slick 3
Effective Test Driven Database Development Gojko Adzic
EXAM 1 NEXT TUESDAY…. EXAMPLE QUESTIONS 1.Why is the notion of a “state” important in relational database technology? What does it refer to? 2.What do.
Persistance Android. Adding Persistance SQL Refresher Understand how to create and migrate SQLLite database with android APIs. – Get all tasks – Add a.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
XmlBlackBox The presentation Alexander Crea June the 15st 2010 The presentation Alexander Crea June the 15st 2010
Presented by, MySQL & O’Reilly Media, Inc. Top considerations for backup of MySQL Dmitri Joukovski, Zmanda.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
Integration testing Integrate two or more module.i.e. communicate between the modules. Follow a white box testing (Testing the code)
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
TESTING FUNDAMENTALS BY K.KARTHIKEYAN.
Software Quality Assurance and Testing Fazal Rehman Shamil.
CSC 405: Web Application Engineering II8.1 Web programming using PHP What have we learnt? What have we learnt? Underlying technologies of database supported.
Automated Testing in Sakai Testing applications and services in isolation and in context Josh Holtzman, UC Berkeley David Haines, University of Michigan.
Helping the Cause of Medical Device Interoperability Through Standards- based Test Tools DoC/NIST John J. Garguilo January 25,
Level 1-2 Trigger Data Base development Current status and overview Myron Campbell, Alexei Varganov, Stephen Miller University of Michigan August 17, 2000.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
Northwest Arkansas.Net User Group Jay Smith Tyson Foods, Inc. Unit Testing nUnit, nUnitAsp, nUnitForms.
By Durga Dasari. DbFit - DB Unit and Integration test tool  Test-driven database development. Write readable, easy- to-maintain unit and integration.
Copyright 2015 Varigence, Inc. Unit and Integration Testing in SSIS A New Approach Scott @varigence.
Testing PA165 Dec 9, 2014 Petr Adámek, Tomáš Pitner.
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
Testing Tutorial 7.
Do You Want To Pass In First Attempt?
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
Test-Driven Development
PL/SQL Scripting in Oracle:
TDD adoption plan 11/20/2018.
Using JDeveloper.
Testing a persistence layer
MySQL Migration Toolkit
Database Software.
Database Management Systems
Developing and testing enterprise Java applications
UFCEUS-20-2 Web Programming
SSDT, Docker, and (Azure) DevOps
SSDT, Docker, and (Azure) DevOps
Presentation transcript:

How to Test Data Acces Code or Rube Goldberg:Software Developer

Who am I? Jonathan Baker Consulting Software Engineer – OCLC Over 10 years of Java development exp. Also stints at Amazon, Nationwide

Testing Data Access Code

Test Data SQL Code Testing Data Access Code Tables What?

Definitions Unit testing - a software verification and validation method in which a programmer tests if individual units of source code are fit for usesource code System testing - testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements requirements Integration Testing From Wikipedia

Unit Testing Data Access Code Why? Red Green Refactor TDD

Unit Testing Data Access Code Why Not?

Unit Testing Data Access Code How? Home-grown mocking Standard Mocking libraries (mockito, JMock, Easy Mock, etc.) Specialized DB mocking - MockRunner

Unit Testing Data Access Code How? To the code…

Unit Testing Data Access Code The Problem

Test Data SQL Code Unit Testing Data Access Code Tables What?

Test Data SQL Code Integration Testing Data Access Code Tables What?

Integration Testing Data Access Code Why?

Integration Testing Data Access Code Why Not?

Integration Testing Data Access Code How? Database – existing, test-specific (in-memory or stand-alone) Table structure – sql scripts, liquibase, dbdeploy, c5- db-migration, dbmaintain, scala-migrations Test data – sql scripts, spring testing infrastructure, dbunit, unitils, Test harness – junit, test NG, etc.

Integration Testing Data Access Code How? To the code…

Integration Testing Data Access Code Test using an existing database (i.e. assume all table structure is already there) Pros Should be exact type of database as used in prod Therefore no impedance mis-match between test db and real db. Cons Fragile db down = tests fail, junk data = tests fail, etc Take a long time to run. Expensive – if licenses required

Integration Testing Data Access Code Test using an fresh external database (i.e. create db every time) Pros Should be exact type of database as used in prod Therefore no impedance mis-match between test db and real db. Test data is always fresh Cons Fragile, but not as Fragile db down = tests fail, How to ensure table structure is correct? Take a long time to run. Expensive – if licenses required

Integration Testing Data Access Code Test using an in-memory database (i.e. create in-memory db everytime) Pros Not fragile, everything is within our control Should run faster than running against an actual db No licensing issues with open-source in-memory databases Cons Database mismatch – cannot replicate vendor specific features What about stored procedures? How to ensure table structure is correct?

Integration Testing Data Access Code Recommendations Database - Use an in-memory database for integration testing. H2 – supports compatibility modes (i.e. mysql, oracle, etc) Derby HSQLDB Table Structure - Use source-controlled database scripts to create table structure Liquibase – vendor agnostic XML DSL Sql scripts Other tech (Unitils/dbdeploy/c5-db-migration/dbmaintain/scala-migrations)

Integration Testing Data Access Code Recommendations Test Data Use spring SimpleJdbcTestUtils to load simple sql data scripts (i.e. inserts) DBUnit Unitils Test Harness (junit 4 or test NG) Use Spring integration-testing support. (context loading, transactions, etc) Unitils DBUnit

Technologies -Java 6Java 6 -Spring RELEASESpring -Junit Junit -Liquibase – 1.9.5Liquibase -Hamcrest - 1.1Hamcrest -MockRunner – Please note the maven artifact in the public maven repo is incorrectly configured.MockRunner -H H2 -C3P C3P0 -Mysql Mysql

References Database Testing: How to Regression Test a Relational DatabaseDatabase Testing: How to Regression Test a Relational Database 7 Strategies for Unit Testing DAOs and other Database Code7 Strategies for Unit Testing DAOs and other Database Code Unit testing database code Spring Docs - Testing

Questions? How much wood would a woodchuck chuck if a woodchuck could chuck wood?