SlideShare a Scribd company logo
1 of 11
Test-Driven SQLTest-Driven SQL
Chris OldwoodChris Oldwood
Agile on the Beach 2014Agile on the Beach 2014
@chrisoldwood / gort@cix.co.uk@chrisoldwood / gort@cix.co.uk
SELECT * FROM ScopeSELECT * FROM Scope
 PreamblePreamble
 SQL Unit TestingSQL Unit Testing
 TDD by ExampleTDD by Example
 QuestionsQuestions
SQL Is Just Code…SQL Is Just Code…
……MostlyMostly
SQL Unit TestingSQL Unit Testing
Functional TestingFunctional Testing
Tests should verify the publiclyTests should verify the publicly
observable behaviour not theobservable behaviour not the
choice of implementationchoice of implementation
Development SandboxDevelopment Sandbox
 IsolationIsolation
 Fast feedbackFast feedback
 DeterministicDeterministic
 ToolingTooling
Example TestExample Test
create procedure test._@TestSetUp@_Something
as
-- common arrangement
go
create procedure test._@Test@_Something_ShouldDoAnotherThing
as
declare @arrangement varchar(100) = 'arrangement';
declare @expected int = 42;
declare @actual int = public.ActOnArrangement();
exec ssunit.AssertIntegerEqualTo @expected, @actual;
go
exec ssunit.RunTests;
Example FeatureExample Feature
Produce a report showing howProduce a report showing how
many bugs each developer hasmany bugs each developer has
assigned to them.assigned to them.
Questions?Questions?
Want to Know More?Want to Know More?
BlogBlog
http://chrisoldwood.blogspot.comhttp://chrisoldwood.blogspot.com
SQL-Unit / SQL-Cop / sql2doxygenSQL-Unit / SQL-Cop / sql2doxygen
http://www.http://www.chrisoldwood.comchrisoldwood.com/sql.htm/sql.htm
http://github.com/chrisoldwoodhttp://github.com/chrisoldwood
@chrisoldwood / gort@cix.co.uk@chrisoldwood / gort@cix.co.uk

More Related Content

What's hot

Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)David Ehringer
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testingpleeps
 
Test driven development
Test driven developmentTest driven development
Test driven developmentlukaszkujawa
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentMireia Sangalo
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentConsulthinkspa
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy CodeEyal Golan
 
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)Tech in Asia ID
 
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile appsTech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile appsFandy Gotama
 
Design for Testability
Design for Testability Design for Testability
Design for Testability Pawel Kalbrun
 
TDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesTDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesDavid Rodenas
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataCory Foy
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit TestingShaun Abram
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Deepak Singhvi
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing FundamentalsRichard Paul
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testingikhwanhayat
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentDhaval Dalal
 

What's hot (20)

TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Grails unit testing
Grails unit testingGrails unit testing
Grails unit testing
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
 
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile appsTech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
 
PHPUnit - Unit testing
PHPUnit - Unit testingPHPUnit - Unit testing
PHPUnit - Unit testing
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 
TDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD TechniquesTDD CrashCourse Part3: TDD Techniques
TDD CrashCourse Part3: TDD Techniques
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing Fundamentals
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit test-using-spock in Grails
Unit test-using-spock in GrailsUnit test-using-spock in Grails
Unit test-using-spock in Grails
 

Viewers also liked

Becoming a Bitter Programmer
Becoming a Bitter ProgrammerBecoming a Bitter Programmer
Becoming a Bitter ProgrammerChris Oldwood
 
Waltzing with Branches [Agile o/t Beach]
Waltzing with Branches [Agile o/t Beach]Waltzing with Branches [Agile o/t Beach]
Waltzing with Branches [Agile o/t Beach]Chris Oldwood
 
TAO Refresh - Automation of Data Spike Flagging Quality
TAO Refresh - Automation of Data Spike Flagging Quality TAO Refresh - Automation of Data Spike Flagging Quality
TAO Refresh - Automation of Data Spike Flagging Quality Sathishkumar Samiappan
 
Continuous Delivery and Feature Flagging
Continuous Delivery and Feature FlaggingContinuous Delivery and Feature Flagging
Continuous Delivery and Feature FlaggingLaunchDarkly
 
0 fenomenele de_langa_noi_ii
0 fenomenele de_langa_noi_ii0 fenomenele de_langa_noi_ii
0 fenomenele de_langa_noi_iiala_camerzan
 
MΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣ
MΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣMΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣ
MΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣbasiakouth
 
Manpower consultants in doha, qatar
Manpower consultants in doha, qatarManpower consultants in doha, qatar
Manpower consultants in doha, qatarqatpedia
 
Multimedia presentation:obsolete and emerging tech
Multimedia presentation:obsolete and emerging techMultimedia presentation:obsolete and emerging tech
Multimedia presentation:obsolete and emerging techheather page
 
Your thanksgiving dinner
Your thanksgiving dinnerYour thanksgiving dinner
Your thanksgiving dinnerkathrynjacobi
 
Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...
Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...
Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...Global Institute GIPPEC
 
Water chemistry for kindasa final ii
Water chemistry for kindasa final iiWater chemistry for kindasa final ii
Water chemistry for kindasa final iiInaam Khan
 
عرض الاجتماعيات اوروبا
عرض الاجتماعيات اوروباعرض الاجتماعيات اوروبا
عرض الاجتماعيات اوروباjouury
 

Viewers also liked (14)

Becoming a Bitter Programmer
Becoming a Bitter ProgrammerBecoming a Bitter Programmer
Becoming a Bitter Programmer
 
Waltzing with Branches [Agile o/t Beach]
Waltzing with Branches [Agile o/t Beach]Waltzing with Branches [Agile o/t Beach]
Waltzing with Branches [Agile o/t Beach]
 
TAO Refresh - Automation of Data Spike Flagging Quality
TAO Refresh - Automation of Data Spike Flagging Quality TAO Refresh - Automation of Data Spike Flagging Quality
TAO Refresh - Automation of Data Spike Flagging Quality
 
Continuous Delivery and Feature Flagging
Continuous Delivery and Feature FlaggingContinuous Delivery and Feature Flagging
Continuous Delivery and Feature Flagging
 
0 fenomenele de_langa_noi_ii
0 fenomenele de_langa_noi_ii0 fenomenele de_langa_noi_ii
0 fenomenele de_langa_noi_ii
 
Strukture
StruktureStrukture
Strukture
 
MΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣ
MΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣMΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣ
MΟΥΣΕΙΟ ΣΧΟΛΙΚΗΣ ΖΩΗΣ
 
Manpower consultants in doha, qatar
Manpower consultants in doha, qatarManpower consultants in doha, qatar
Manpower consultants in doha, qatar
 
Multimedia presentation:obsolete and emerging tech
Multimedia presentation:obsolete and emerging techMultimedia presentation:obsolete and emerging tech
Multimedia presentation:obsolete and emerging tech
 
Your thanksgiving dinner
Your thanksgiving dinnerYour thanksgiving dinner
Your thanksgiving dinner
 
Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...
Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...
Clinical Programs in the Department of Supportive Care - Cancer Rehab and Sur...
 
Water chemistry for kindasa final ii
Water chemistry for kindasa final iiWater chemistry for kindasa final ii
Water chemistry for kindasa final ii
 
Efa sofiana
Efa sofianaEfa sofiana
Efa sofiana
 
عرض الاجتماعيات اوروبا
عرض الاجتماعيات اوروباعرض الاجتماعيات اوروبا
عرض الاجتماعيات اوروبا
 

Similar to Test-Driven SQL

Developer Tests - Things to Know
Developer Tests - Things to KnowDeveloper Tests - Things to Know
Developer Tests - Things to KnowVaidas Pilkauskas
 
How I Learned to Stop Worrying and Love Legacy Code
How I Learned to Stop Worrying and Love Legacy CodeHow I Learned to Stop Worrying and Love Legacy Code
How I Learned to Stop Worrying and Love Legacy CodeGene Gotimer
 
Adopting TDD - by Don McGreal
Adopting TDD - by Don McGrealAdopting TDD - by Don McGreal
Adopting TDD - by Don McGrealSynerzip
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016Gavin Pickin
 
Test-Driven development; why you should never code without it
Test-Driven development; why you should never code without itTest-Driven development; why you should never code without it
Test-Driven development; why you should never code without itJad Salhani
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit TestingKeir Bowden
 
Testing in a continuous delivery world - Lean Agile Scotland
Testing in a continuous delivery world - Lean Agile ScotlandTesting in a continuous delivery world - Lean Agile Scotland
Testing in a continuous delivery world - Lean Agile ScotlandWouter Lagerweij
 
Unit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityUnit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityVictor Rentea
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0Ganesh Kondal
 
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012Tieturi Oy
 
AD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages AppsAD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages Appsbeglee
 
Config Management Camp 2017 - If it moves, give it a pipeline
Config Management Camp 2017 - If it moves, give it a pipelineConfig Management Camp 2017 - If it moves, give it a pipeline
Config Management Camp 2017 - If it moves, give it a pipelineMark Rendell
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by ExampleNalin Goonawardana
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 

Similar to Test-Driven SQL (20)

Oxente BDD
Oxente BDDOxente BDD
Oxente BDD
 
Developer Tests - Things to Know
Developer Tests - Things to KnowDeveloper Tests - Things to Know
Developer Tests - Things to Know
 
How I Learned to Stop Worrying and Love Legacy Code
How I Learned to Stop Worrying and Love Legacy CodeHow I Learned to Stop Worrying and Love Legacy Code
How I Learned to Stop Worrying and Love Legacy Code
 
Adopting TDD - by Don McGreal
Adopting TDD - by Don McGrealAdopting TDD - by Don McGreal
Adopting TDD - by Don McGreal
 
How to write Testable Javascript
How to write Testable JavascriptHow to write Testable Javascript
How to write Testable Javascript
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
 
Test-Driven development; why you should never code without it
Test-Driven development; why you should never code without itTest-Driven development; why you should never code without it
Test-Driven development; why you should never code without it
 
TDD Agile Tour Beirut
TDD  Agile Tour BeirutTDD  Agile Tour Beirut
TDD Agile Tour Beirut
 
Apex Unit Testing in the Real World
Apex Unit Testing in the Real WorldApex Unit Testing in the Real World
Apex Unit Testing in the Real World
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Testing in a continuous delivery world - Lean Agile Scotland
Testing in a continuous delivery world - Lean Agile ScotlandTesting in a continuous delivery world - Lean Agile Scotland
Testing in a continuous delivery world - Lean Agile Scotland
 
Introduction to TDD and Mocking
Introduction to TDD and MockingIntroduction to TDD and Mocking
Introduction to TDD and Mocking
 
Unit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityUnit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of Purity
 
Test driven development v1.0
Test driven development v1.0Test driven development v1.0
Test driven development v1.0
 
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
TechDays 2013 Juhani Lind: Acceptance Test Driven Development With VS 2012
 
AD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages AppsAD208 - End to End Quality Processes for Top Notch XPages Apps
AD208 - End to End Quality Processes for Top Notch XPages Apps
 
Config Management Camp 2017 - If it moves, give it a pipeline
Config Management Camp 2017 - If it moves, give it a pipelineConfig Management Camp 2017 - If it moves, give it a pipeline
Config Management Camp 2017 - If it moves, give it a pipeline
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
 

More from Chris Oldwood

In The Toolbox - LIVE!
In The Toolbox - LIVE!In The Toolbox - LIVE!
In The Toolbox - LIVE!Chris Oldwood
 
Waltzing with Branches [ACCU]
Waltzing with Branches [ACCU]Waltzing with Branches [ACCU]
Waltzing with Branches [ACCU]Chris Oldwood
 
Using xUnit as a Swiss-Aarmy Testing Toolkit
Using xUnit as a Swiss-Aarmy Testing ToolkitUsing xUnit as a Swiss-Aarmy Testing Toolkit
Using xUnit as a Swiss-Aarmy Testing ToolkitChris Oldwood
 
xUnit Style Database Testing
xUnit Style Database TestingxUnit Style Database Testing
xUnit Style Database TestingChris Oldwood
 
Version Control - Patterns and Practices
Version Control - Patterns and PracticesVersion Control - Patterns and Practices
Version Control - Patterns and PracticesChris Oldwood
 
Requiem (For Windows XP)
Requiem (For Windows XP)Requiem (For Windows XP)
Requiem (For Windows XP)Chris Oldwood
 
(Re)Reading the Classics
(Re)Reading the Classics(Re)Reading the Classics
(Re)Reading the ClassicsChris Oldwood
 

More from Chris Oldwood (14)

The __far* Side
The __far* SideThe __far* Side
The __far* Side
 
Monolithic Delivery
Monolithic DeliveryMonolithic Delivery
Monolithic Delivery
 
A Test of Strength
A Test of StrengthA Test of Strength
A Test of Strength
 
In The Toolbox - LIVE!
In The Toolbox - LIVE!In The Toolbox - LIVE!
In The Toolbox - LIVE!
 
Waltzing with Branches [ACCU]
Waltzing with Branches [ACCU]Waltzing with Branches [ACCU]
Waltzing with Branches [ACCU]
 
Continuous Delivery
Continuous DeliveryContinuous Delivery
Continuous Delivery
 
Using xUnit as a Swiss-Aarmy Testing Toolkit
Using xUnit as a Swiss-Aarmy Testing ToolkitUsing xUnit as a Swiss-Aarmy Testing Toolkit
Using xUnit as a Swiss-Aarmy Testing Toolkit
 
xUnit Style Database Testing
xUnit Style Database TestingxUnit Style Database Testing
xUnit Style Database Testing
 
Robust Software
Robust SoftwareRobust Software
Robust Software
 
Version Control - Patterns and Practices
Version Control - Patterns and PracticesVersion Control - Patterns and Practices
Version Control - Patterns and Practices
 
Requiem (For Windows XP)
Requiem (For Windows XP)Requiem (For Windows XP)
Requiem (For Windows XP)
 
(Re)Reading the Classics
(Re)Reading the Classics(Re)Reading the Classics
(Re)Reading the Classics
 
Recycle Bin 101
Recycle Bin 101Recycle Bin 101
Recycle Bin 101
 
The Art of Code
The Art of CodeThe Art of Code
The Art of Code
 

Recently uploaded

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 

Recently uploaded (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 

Test-Driven SQL

  • 1. Test-Driven SQLTest-Driven SQL Chris OldwoodChris Oldwood Agile on the Beach 2014Agile on the Beach 2014 @chrisoldwood / gort@cix.co.uk@chrisoldwood / gort@cix.co.uk
  • 2. SELECT * FROM ScopeSELECT * FROM Scope  PreamblePreamble  SQL Unit TestingSQL Unit Testing  TDD by ExampleTDD by Example  QuestionsQuestions
  • 3. SQL Is Just Code…SQL Is Just Code…
  • 5. SQL Unit TestingSQL Unit Testing
  • 6. Functional TestingFunctional Testing Tests should verify the publiclyTests should verify the publicly observable behaviour not theobservable behaviour not the choice of implementationchoice of implementation
  • 7. Development SandboxDevelopment Sandbox  IsolationIsolation  Fast feedbackFast feedback  DeterministicDeterministic  ToolingTooling
  • 8. Example TestExample Test create procedure test._@TestSetUp@_Something as -- common arrangement go create procedure test._@Test@_Something_ShouldDoAnotherThing as declare @arrangement varchar(100) = 'arrangement'; declare @expected int = 42; declare @actual int = public.ActOnArrangement(); exec ssunit.AssertIntegerEqualTo @expected, @actual; go exec ssunit.RunTests;
  • 9. Example FeatureExample Feature Produce a report showing howProduce a report showing how many bugs each developer hasmany bugs each developer has assigned to them.assigned to them.
  • 11. Want to Know More?Want to Know More? BlogBlog http://chrisoldwood.blogspot.comhttp://chrisoldwood.blogspot.com SQL-Unit / SQL-Cop / sql2doxygenSQL-Unit / SQL-Cop / sql2doxygen http://www.http://www.chrisoldwood.comchrisoldwood.com/sql.htm/sql.htm http://github.com/chrisoldwoodhttp://github.com/chrisoldwood @chrisoldwood / gort@cix.co.uk@chrisoldwood / gort@cix.co.uk

Editor's Notes

  1. Challenge assumption that SQL development is easy In particular note that it is still a dark art, e.g. borked query plans and compilation hints – how do you ensure functional correctness?
  2. OMG he used SELECT *! Mostly a talk on “how”, but first a bit of “why”… Breif overview of oscillating procedure and how unit tests could provide some security
  3. The examples may be in Java, but the message is equally appicable to SQL code development Much SQL code is the epitome of legacy code
  4. Scott Ambler is the main author I’ve come across, trust him if not me.
  5. Unit testing is part of the mechanics of TDD and requires a tightly controlled development environment Here we are assuming a loosely coupled environment and same language testing for skills portability
  6. Implementation details should be tested as a by-product of the publicly observable behaviour If it’s not observable what purpose does it serve?
  7. Need to be isolated from other developers – own database (free Express editions are perfect) TDD requires fast feedback to keep the steps small – fast running tests require minimal data Mock out non-deterministic functions like datetime, GUID, etc (more likely used on infrequent writes than reads). SQL automated test tooling is less mature than other environments but easy to knock up
  8. Naming tests is probably the hardest part, and also the most important 3 sections – arrange, act, assert Many different types of asserts – values, table contents, exceptions If required introduce helper procedures and functions to keep the arrangement readable
  9. The Bug Tracking System in this example is the SQL-Unit sample database