database unit testing with visual studio 2010

15
Database unit testing with visual studio 2010 Anthony Brown [email protected]

Upload: dalton-beck

Post on 31-Dec-2015

57 views

Category:

Documents


0 download

DESCRIPTION

Database unit testing with visual studio 2010. Anthony Brown [email protected]. Agenda. What is unit testing What is database unit testing When to use it Demo (that will fail….). Rocket science. In programming. In programming. Why unit test?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Database unit testing with visual studio 2010

Database unit testing with visual studio 2010

Anthony Brown

[email protected]

Page 2: Database unit testing with visual studio 2010

Agenda

• What is unit testing

• What is database unit testing

• When to use it

• Demo (that will fail….)

Page 3: Database unit testing with visual studio 2010

Rocket science

Page 4: Database unit testing with visual studio 2010

In programming

Calculate gender

TitleFirstnameLastname

TitleFirstnameLastnameGender

Front end application Database table

Mr John Lennon Male

Title Firstname Lastname Gender

Page 5: Database unit testing with visual studio 2010

In programming

Calculate gender

TitleFirstnameLastname

TitleFirstnameLastnameGender

Front end application Database table

Mr John Lennon Male

Title Firstname Lastname Gender

Unit test this part

Page 6: Database unit testing with visual studio 2010

Why unit test?

• Allows you to ensure that individual components do what they are supposed to

• Catch bugs in development cycle rather than test cycle

• Easier to refactor

Page 7: Database unit testing with visual studio 2010

It is not a substitute

Page 8: Database unit testing with visual studio 2010

Database unit testing

Stored procedure

TitleFirstnameLastname

Front end application Database table

Mr John Lennon Male

Title Firstname Lastname Gender

Page 9: Database unit testing with visual studio 2010

Database unit testing

Stored procedure

TitleFirstnameLastname

Front end application Database table

Mr John Lennon Male

Title Firstname Lastname Gender

Unit test this

Page 10: Database unit testing with visual studio 2010

Prerequisites

• Create database in a consistent state

• Source control database objects

• Test data

Page 11: Database unit testing with visual studio 2010

Reasons to not write database unit tests

• CRUD operations

• Time

• Management

Page 12: Database unit testing with visual studio 2010

Visual studio 2010 database unit tests

• Only design in premium & ultimate (run in professional)

• Integrated with visual studio test framework

• Can be run as part of continuous integration build

• Data generator

Page 13: Database unit testing with visual studio 2010

Demo

Page 14: Database unit testing with visual studio 2010

Coming up…

#SQLBITS

Speaker Title Room

Stephan Stoltze Writeback-Here Comes the Sun Aintree

James Boother POSH Clustering LancasterKasper de Jonge Building Great Models for Crescent Pearce

Andy Leonard Designing an SSIS Framework BoardroomMilos Radivojevic TSQL Performance Recommendations Empire

Christina E. Leo Working with Server Side Traces Derby

Page 15: Database unit testing with visual studio 2010

Picture sources• http://www.flickr.com/photos/34388067@N00/150021646/

• http://en.wikipedia.org/wiki/File:Argentina_substitute_bench_%E2%80%93_Portugal_vs._Argentina,_9th_February_2011_%281%29.jpg