SlideShare a Scribd company logo
getlatestversion
Testing your databases
Alessandro Alpi (@suxstellino)
Data Platform MVP since 2008 alessandro.alpi@engageitservices.it
DevOps concepts
Unit Testing concepts
Why Unit Testing on databases
Unit Testing frameworks
Unit Testing solutions
Conclusions
Q&A
Agenda
DevOps is a culture, movement or practice that emphasizes
the collaboration and communication of both software
developers and other information-technology(IT)
professionals while automating the process of software
delivery and infrastructure changes. It aims at establishing a
culture and environment where building, testing, and
releasing software, can happen rapidly, frequently, and more
reliably
(source Wikipedia)
DevOps concept
We will speak about…
Development teams
We’re writing code and features
Preventing regressions
We’d like to avoid breaking changes for the customers
Reducing bugs
We’d like to avoid any time waste (on fixes)
Improving quality
We want to reach the best quality for our products
We want reach these goals
Involve QA teams
We want to get a team that works on Quality Assurance
Implement backward compatibility
We want to develop using refactoring patterns
Cover with unit tests
We could start writing tests, before implementing the feature
Quality with productivity
We can finally use tools and frameworks
What we need to reach DevOps
IDE
Source Control Manager
(Version control system)
Build server and process
(also for automation)
QA / Unit test process
(automated)
Release processes
(automated and reliable)
Integration
OperationDevelopment
In computer programming, unit testing is a software testing
method by which individual units of source code, sets of one or
more computer program modules together with associated
control data, usage procedures, and operating procedures are
tested to determine if they are fit for use. The primary purpose
of this approach is to find out bugs and prevent regressions.
(source: Wikipedia)
Unit Testing concept
Unit testing – why?
• Focus on Mission-critical capabs
• Supporting evolutionary development
continuous improvement
• Prevent regressions
• Reduce the number of bugs
• Reduce the development costs
for fixes
«Fix bugs as soon as you find them»
Unfixed bugs camouflage other bugs
Unfixed bugs suggest that “the quality isn’t important”
Discussing unfixed bugs is a waste of time
Unfixed bugs lead to duplicate effort
Best practice..
Unfixed bugs lead to unreliable metrics
Unfixed bugs distract the entire team
Unfixed bugs hinder short-notice releases
Unfixed bugs lead to inaccurate estimates
Fixing familiar code is easier
Fixing a bug today costs less than tomorrow
Lesson learnt
Executing the code on a copy of production data
Manual testing
T-SQL debug for checking variable values
PRINT, PRINT, SELECT…
Not repeatable and human errors (subjectivity)
Some test cases forgotten as the code changes.
Some test is made on structures with “test-unrelated” constraints which
could break the test itself
What we usually do when “testing”
Calculations in procedures and functions
Constraints (schema)
Edge cases of data DML
Expected behavior of data DML
Error Handling
Security
Standards (SQLCop)
What we have to test on databases
A possible solution
tSQLt (free)
Simple to install
Simple test schema (Assemble, Act, Assert)
Framework in t-sql
Can be installed as tool with Red Gate SQL Test (UI, not
free)
SQL Server Management Studio
Using t-sql
Using Red Gate SQL Test (tsqlt, not free)
Integrated with SQLCop framework
Built-in
tsqlt schema
Classes
Group of stored procedures (tests)
User defined schema
Conventions
Naming: test*
Tools
Run
NewTestClass/DropClass
Fail/Assert
Uninstall
tSQLt – Structure
tSQLt – Pipeline
Assemble Act Assert
Create fakes
Specify fakes options
Populate fakes
Execute commands
Apply biz logic
Execute proc or func
Expected values
Expected metadata
Expected behaviors
tSQLt + SQL Server Management Studio
LET’S PLAY
There is no excuse for NOT testing
like any other piece of code
Tools exist for testing
Tools exist for generating data
Testing processes really improve the quality
Allows us to respect the application business requirements
Conclusions
..and, hopefully, answers!
Questions?
THANK YOU!
http://www.red-gate.com/products/sql-development/sql-test/
http://tsqlt.org/
http://sourceforge.net/projects/tsqlunit/
http://msdn.microsoft.com/en-us/library/dd172118(v=vs.100).aspx (VS 2010)
http://blogs.msdn.com/b/ssdt/archive/2012/12/07/getting-started-with-sql-server-database-unit-testing-in-
ssdt.aspx (SSDT)
http://msdn.microsoft.com/en-us/library/jj851200(v=vs.103).aspx (VS 2012)
http://channel9.msdn.com/Events/Visual-Studio/Launch-2013/QE107 (VS 2013)
http://msdn.microsoft.com/it-it/library/dn383992.aspx (Article on CI)
http://msdn.microsoft.com/en-us/library/jj907294.aspx (DLM)
http://en.wikipedia.org/wiki/Unit_testing
https://www.simple-talk.com/sql/t-sql-programming/getting-started-testing-databases-with-tsqlt/
http://utplsql.sourceforge.net/ (PL-SQL)
https://github.com/chrisoldwood/SS-Unit
Resources
My work
SQL Server sotto source control
Unit testing con SQL Server
SQL Server Continuous Integration
Putting our database under source control
Unit testing on SQL Server databases with tSQLt
ALM on docs.com
Virtual chapter su SQL Server e source control
ALM su getlatestversion.it
getlatestversion
Books
Database unit testing for SQL Server using tSQLt
Grazie agli sponsor
http://bit.ly/DOAW16FEED1
Dedicateci 2 minuti del vostro tempo,
e ci aiuterete a crescere e migliorare!
Track Intro
http://bit.ly/DOAW16FEED2
Track Avanzata

More Related Content

What's hot (20)

PPTX
Full Testing Experience - Visual Studio and TFS 2010
Ed Blankenship
 
PPTX
Silk Performer Presentation v1
Sun Technlogies
 
PPTX
Dev ops developer (session 3)
MSDEVMTL
 
DOCX
Testing in TFS
Sampath kumar Mohan
 
PPT
Visual Studio Team System 2010
ukdpe
 
PPTX
Selenium training eduxfactor
KapilSai3
 
PDF
Lap around visual studio alm 2013
Angela Dugan
 
PPT
Improving The Software Development Lifecycle With Visual Studio Team System
matthewphillips
 
PDF
Agile testing - Principles and best practices
Dr Ganesh Iyer
 
PDF
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha
 
PPT
The first looks at VSTS2010
Pascal van der Horst
 
PPT
Polarion Tomorrows ALM Platform Today
polarion
 
PPTX
Continuous performance testing
SQALab
 
PDF
Windows 10 application testing with the help of cloud-based solution - Apptim...
Apptimized
 
PPTX
Strategies in continuous delivery
Aviran Mordo
 
PDF
Test pyramid
Poornima Durairaj
 
PDF
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
PDF
Automate across Platform, OS, Technologies with TaaS
Anand Bagmar
 
PPTX
Visual studio 2010
Rishu Mehra
 
PPTX
PHX Session #1: Development Best Practices And How Microsoft Helps
Steve Lange
 
Full Testing Experience - Visual Studio and TFS 2010
Ed Blankenship
 
Silk Performer Presentation v1
Sun Technlogies
 
Dev ops developer (session 3)
MSDEVMTL
 
Testing in TFS
Sampath kumar Mohan
 
Visual Studio Team System 2010
ukdpe
 
Selenium training eduxfactor
KapilSai3
 
Lap around visual studio alm 2013
Angela Dugan
 
Improving The Software Development Lifecycle With Visual Studio Team System
matthewphillips
 
Agile testing - Principles and best practices
Dr Ganesh Iyer
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha
 
The first looks at VSTS2010
Pascal van der Horst
 
Polarion Tomorrows ALM Platform Today
polarion
 
Continuous performance testing
SQALab
 
Windows 10 application testing with the help of cloud-based solution - Apptim...
Apptimized
 
Strategies in continuous delivery
Aviran Mordo
 
Test pyramid
Poornima Durairaj
 
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Automate across Platform, OS, Technologies with TaaS
Anand Bagmar
 
Visual studio 2010
Rishu Mehra
 
PHX Session #1: Development Best Practices And How Microsoft Helps
Steve Lange
 

Viewers also liked (20)

PPTX
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
Alessandro Alpi
 
PPTX
Quick intro sul Source Control su SQL Server
Alessandro Alpi
 
PPTX
Oraciones simples con solucionario (ppt)
CastilloAguilera
 
PPT
Cwit interview
akhtarsaad
 
PPTX
DotNetCampus - Continuous Integration con Sql Server
Alessandro Alpi
 
PDF
Lista 5
Gerson Coppes
 
PPSX
Slide sharing
alexandersaa2013
 
PPTX
PASS Virtual Chapter - Unit Testing su SQL Server
Alessandro Alpi
 
PPTX
Lietuviai praranda laisvę
Erika Bražienė
 
PPTX
Activity 3
alexandersaa2013
 
PPTX
[ITA] SQL Saturday 264 - Put databases in ALM backgrounds
Alessandro Alpi
 
PPTX
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
Alessandro Alpi
 
PPTX
PASS Virtual Chapter - SQL Server Continuous Integration
Alessandro Alpi
 
PDF
Lista 2 - geografia
Gerson Coppes
 
PDF
Acting In The Digital Age Workshop @UMFF
Rosalyn Coleman Williams
 
PPTX
Gordonas sausio
Erika Bražienė
 
PPTX
Educational managment task_2
alexandersaa2013
 
PPTX
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
Alessandro Alpi
 
PDF
2 67-1379416025-9. automation nad virtual.full
Kier Francisco
 
PPTX
[ITA] SQL Saturday 257 - Put databases under source control
Alessandro Alpi
 
[ENG] Sql Saturday 355 in Parma - New "SQL Server databases under source cont...
Alessandro Alpi
 
Quick intro sul Source Control su SQL Server
Alessandro Alpi
 
Oraciones simples con solucionario (ppt)
CastilloAguilera
 
Cwit interview
akhtarsaad
 
DotNetCampus - Continuous Integration con Sql Server
Alessandro Alpi
 
Lista 5
Gerson Coppes
 
Slide sharing
alexandersaa2013
 
PASS Virtual Chapter - Unit Testing su SQL Server
Alessandro Alpi
 
Lietuviai praranda laisvę
Erika Bražienė
 
Activity 3
alexandersaa2013
 
[ITA] SQL Saturday 264 - Put databases in ALM backgrounds
Alessandro Alpi
 
DevOpsHeroes 2016 - Realizzare Continouous Integration con SQL Server e Visua...
Alessandro Alpi
 
PASS Virtual Chapter - SQL Server Continuous Integration
Alessandro Alpi
 
Lista 2 - geografia
Gerson Coppes
 
Acting In The Digital Age Workshop @UMFF
Rosalyn Coleman Williams
 
Gordonas sausio
Erika Bražienė
 
Educational managment task_2
alexandersaa2013
 
[ITA] Sql Saturday 355 in Parma - New SQL Server databases under source control
Alessandro Alpi
 
2 67-1379416025-9. automation nad virtual.full
Kier Francisco
 
[ITA] SQL Saturday 257 - Put databases under source control
Alessandro Alpi
 
Ad

Similar to #DOAW16 - DevOps@work Roma 2016 - Testing your databases (20)

PPT
The Magic Of Application Lifecycle Management In Vs Public
David Solivan
 
PDF
Agile testing
Raj Indugula
 
PDF
Software Quality and Test Strategies for Ruby and Rails Applications
Bhavin Javia
 
PPT
12 Rational Solo Pruebas 2009
Pepe
 
PPTX
Enforcing Quality with DevOps Pipeline Gates
Michael King
 
PPT
Manualtestingppt
balaji naidu
 
PPTX
Software Project Management - NESDEV
Krit Kamtuo
 
PDF
Different Methodologies For Testing Web Application Testing
Rachel Davis
 
PDF
SELJE_Database_Unit_Testing_Slides.pdf
Eric Selje
 
PDF
Test automation
Jitendra Malviya
 
PPTX
Testing 101
Noam Barkai
 
PPT
But Did You Test It
Ruth Blakely
 
PPT
Gcs day1
Sriram Angajala
 
PPT
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Engineering Software Lab
 
PPT
Getting Unstuck: Working with Legacy Code and Data
Cory Foy
 
PPTX
Making the Unstable Stable - An Intro To Testing
Cameron Presley
 
PPT
1 Ads
lcbj
 
PPTX
DevOps for Machine Learning overview en-us
eltonrodriguez11
 
PDF
Visual Studio ALM and DevOps Tools Walkthrough
Angela Dugan
 
PDF
AfterTest Madrid March 2016 - DevOps and Testing Introduction
Peter Marshall
 
The Magic Of Application Lifecycle Management In Vs Public
David Solivan
 
Agile testing
Raj Indugula
 
Software Quality and Test Strategies for Ruby and Rails Applications
Bhavin Javia
 
12 Rational Solo Pruebas 2009
Pepe
 
Enforcing Quality with DevOps Pipeline Gates
Michael King
 
Manualtestingppt
balaji naidu
 
Software Project Management - NESDEV
Krit Kamtuo
 
Different Methodologies For Testing Web Application Testing
Rachel Davis
 
SELJE_Database_Unit_Testing_Slides.pdf
Eric Selje
 
Test automation
Jitendra Malviya
 
Testing 101
Noam Barkai
 
But Did You Test It
Ruth Blakely
 
Gcs day1
Sriram Angajala
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Engineering Software Lab
 
Getting Unstuck: Working with Legacy Code and Data
Cory Foy
 
Making the Unstable Stable - An Intro To Testing
Cameron Presley
 
1 Ads
lcbj
 
DevOps for Machine Learning overview en-us
eltonrodriguez11
 
Visual Studio ALM and DevOps Tools Walkthrough
Angela Dugan
 
AfterTest Madrid March 2016 - DevOps and Testing Introduction
Peter Marshall
 
Ad

More from Alessandro Alpi (15)

PPTX
Mvp4 croatia - Being a dba in a devops world
Alessandro Alpi
 
PPTX
Digital warriors 2020 - Smart?
Alessandro Alpi
 
PDF
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
Alessandro Alpi
 
PPTX
Sql Wars - SQL Clone vs Docker Containers
Alessandro Alpi
 
PPTX
Doaw2020 - Dalla produzione alla QA, provisioning su SQL Server
Alessandro Alpi
 
PPTX
Wpc2019 - Distruggere DevOps, la storia di un vero team
Alessandro Alpi
 
PPTX
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
Alessandro Alpi
 
PPTX
Configuration e change management con Disciplined Agile Framework
Alessandro Alpi
 
PDF
Basta poco per distruggere DevOps
Alessandro Alpi
 
PDF
Automatizzare il processo di link dei database con redgate source control
Alessandro Alpi
 
PPTX
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
Alessandro Alpi
 
PPTX
Sql Saturday a Pordenone - Sql Server journey, da dev a ops
Alessandro Alpi
 
PPTX
PASS Virtual Chapter - SQL Server Continuous Deployment
Alessandro Alpi
 
PPTX
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
Alessandro Alpi
 
PPTX
[Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support
Alessandro Alpi
 
Mvp4 croatia - Being a dba in a devops world
Alessandro Alpi
 
Digital warriors 2020 - Smart?
Alessandro Alpi
 
Sql Wars - SQL the attack of the Clones and the rebellion of the Containers
Alessandro Alpi
 
Sql Wars - SQL Clone vs Docker Containers
Alessandro Alpi
 
Doaw2020 - Dalla produzione alla QA, provisioning su SQL Server
Alessandro Alpi
 
Wpc2019 - Distruggere DevOps, la storia di un vero team
Alessandro Alpi
 
Sql start!2019 Migliorare la produttività per lo sviluppo su SQL Server
Alessandro Alpi
 
Configuration e change management con Disciplined Agile Framework
Alessandro Alpi
 
Basta poco per distruggere DevOps
Alessandro Alpi
 
Automatizzare il processo di link dei database con redgate source control
Alessandro Alpi
 
Sql saturday parma 2017 (#sqlsat675) - Deep space Cosmos DB
Alessandro Alpi
 
Sql Saturday a Pordenone - Sql Server journey, da dev a ops
Alessandro Alpi
 
PASS Virtual Chapter - SQL Server Continuous Deployment
Alessandro Alpi
 
[Ita] Sql Saturday 462 Parma - Sql Server 2016 JSON support
Alessandro Alpi
 
[Eng] Sql Saturday TorinoExpo - Sql Server 2016 JSON support
Alessandro Alpi
 

Recently uploaded (20)

PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Biography of Daniel Podor.pdf
Daniel Podor
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 

#DOAW16 - DevOps@work Roma 2016 - Testing your databases

  • 1. getlatestversion Testing your databases Alessandro Alpi (@suxstellino) Data Platform MVP since 2008 [email protected]
  • 2. DevOps concepts Unit Testing concepts Why Unit Testing on databases Unit Testing frameworks Unit Testing solutions Conclusions Q&A Agenda
  • 3. DevOps is a culture, movement or practice that emphasizes the collaboration and communication of both software developers and other information-technology(IT) professionals while automating the process of software delivery and infrastructure changes. It aims at establishing a culture and environment where building, testing, and releasing software, can happen rapidly, frequently, and more reliably (source Wikipedia) DevOps concept
  • 4. We will speak about… Development teams We’re writing code and features Preventing regressions We’d like to avoid breaking changes for the customers Reducing bugs We’d like to avoid any time waste (on fixes) Improving quality We want to reach the best quality for our products
  • 5. We want reach these goals Involve QA teams We want to get a team that works on Quality Assurance Implement backward compatibility We want to develop using refactoring patterns Cover with unit tests We could start writing tests, before implementing the feature Quality with productivity We can finally use tools and frameworks
  • 6. What we need to reach DevOps IDE Source Control Manager (Version control system) Build server and process (also for automation) QA / Unit test process (automated) Release processes (automated and reliable) Integration OperationDevelopment
  • 7. In computer programming, unit testing is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures are tested to determine if they are fit for use. The primary purpose of this approach is to find out bugs and prevent regressions. (source: Wikipedia) Unit Testing concept
  • 8. Unit testing – why? • Focus on Mission-critical capabs • Supporting evolutionary development continuous improvement • Prevent regressions • Reduce the number of bugs • Reduce the development costs for fixes
  • 9. «Fix bugs as soon as you find them» Unfixed bugs camouflage other bugs Unfixed bugs suggest that “the quality isn’t important” Discussing unfixed bugs is a waste of time Unfixed bugs lead to duplicate effort Best practice..
  • 10. Unfixed bugs lead to unreliable metrics Unfixed bugs distract the entire team Unfixed bugs hinder short-notice releases Unfixed bugs lead to inaccurate estimates Fixing familiar code is easier Fixing a bug today costs less than tomorrow Lesson learnt
  • 11. Executing the code on a copy of production data Manual testing T-SQL debug for checking variable values PRINT, PRINT, SELECT… Not repeatable and human errors (subjectivity) Some test cases forgotten as the code changes. Some test is made on structures with “test-unrelated” constraints which could break the test itself What we usually do when “testing”
  • 12. Calculations in procedures and functions Constraints (schema) Edge cases of data DML Expected behavior of data DML Error Handling Security Standards (SQLCop) What we have to test on databases
  • 13. A possible solution tSQLt (free) Simple to install Simple test schema (Assemble, Act, Assert) Framework in t-sql Can be installed as tool with Red Gate SQL Test (UI, not free) SQL Server Management Studio Using t-sql Using Red Gate SQL Test (tsqlt, not free) Integrated with SQLCop framework
  • 14. Built-in tsqlt schema Classes Group of stored procedures (tests) User defined schema Conventions Naming: test* Tools Run NewTestClass/DropClass Fail/Assert Uninstall tSQLt – Structure
  • 15. tSQLt – Pipeline Assemble Act Assert Create fakes Specify fakes options Populate fakes Execute commands Apply biz logic Execute proc or func Expected values Expected metadata Expected behaviors
  • 16. tSQLt + SQL Server Management Studio LET’S PLAY
  • 17. There is no excuse for NOT testing like any other piece of code Tools exist for testing Tools exist for generating data Testing processes really improve the quality Allows us to respect the application business requirements Conclusions
  • 20. http://www.red-gate.com/products/sql-development/sql-test/ http://tsqlt.org/ http://sourceforge.net/projects/tsqlunit/ http://msdn.microsoft.com/en-us/library/dd172118(v=vs.100).aspx (VS 2010) http://blogs.msdn.com/b/ssdt/archive/2012/12/07/getting-started-with-sql-server-database-unit-testing-in- ssdt.aspx (SSDT) http://msdn.microsoft.com/en-us/library/jj851200(v=vs.103).aspx (VS 2012) http://channel9.msdn.com/Events/Visual-Studio/Launch-2013/QE107 (VS 2013) http://msdn.microsoft.com/it-it/library/dn383992.aspx (Article on CI) http://msdn.microsoft.com/en-us/library/jj907294.aspx (DLM) http://en.wikipedia.org/wiki/Unit_testing https://www.simple-talk.com/sql/t-sql-programming/getting-started-testing-databases-with-tsqlt/ http://utplsql.sourceforge.net/ (PL-SQL) https://github.com/chrisoldwood/SS-Unit Resources
  • 21. My work SQL Server sotto source control Unit testing con SQL Server SQL Server Continuous Integration Putting our database under source control Unit testing on SQL Server databases with tSQLt ALM on docs.com Virtual chapter su SQL Server e source control ALM su getlatestversion.it getlatestversion
  • 22. Books Database unit testing for SQL Server using tSQLt
  • 24. http://bit.ly/DOAW16FEED1 Dedicateci 2 minuti del vostro tempo, e ci aiuterete a crescere e migliorare! Track Intro http://bit.ly/DOAW16FEED2 Track Avanzata