#sqlsatPordenone #sqlsat367 February 28, 2015 Testing your databases Alessandro

Slides:



Advertisements
Similar presentations
Unit Testing in SQL Richard Fennell Engineering Director SqlBits 6 th October 2007.
Advertisements

Test Automation Success: Choosing the Right People & Process
Software Modeling SWE5441 Lecture 3 Eng. Mohammed Timraz
Tools for Agile Development: A Developer’s Perspective Mike Linnen Blog:
Software Delivery. Software Delivery Management  Managing Requirements and Changes  Managing Resources  Managing Configuration  Managing Defects 
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
Concepts of Version Control A Technology-Independent View.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 15 Finalizing.
Application Lifecycle Management in SharePoint 2010 Jeremy Thake.
(code name: Data Dude) Josh Robinson Aculix.
René Balzano Technology Solution Professional Data Platform Microsoft Switzerland Database Development with SQL Server Data Tools (SSDT)
Continuous Integration for Databases Learn how to automate your build and test Steve Jones Red Gate Software Part II of the Continuous Delivery for Databases.
Introduction to SharePoint Development with VS2010 Paul Yuknewicz Lead Program Manager
FINAL DEMO Apollo Crew, group 3 T SW Development Project.
Database Design for DNN Developers Sebastian Leupold.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Testing Tools using Visual Studio Randy Pagels Sr. Developer Technology Specialist Microsoft Corporation.
@benday #vslive Automated Build, Test & Deploy with TFS, ASP.NET, and SQL Server Benjamin
Discussion Panelists: Justin C. Klein Keane Sr. Information Security Specialist University of Pennsylvania Jonathan Hanny Application Security Specialist.
Development Strategies for Web Applications Jonathan Babbage National Superconducting Cyclotron Laboratory.
I Copyright © 2004, Oracle. All rights reserved. Introduction Copyright © 2004, Oracle. All rights reserved.
Testing Session Testing Team-Release Management Team.
Performance Dash A free tool from Microsoft that provides some quick real time information about the status of your SQL Servers.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
Anubha Gupta | Software Engineer Visual Studio Online Microsoft Corp. Visual Studio Enterprise Leveraging modern tools to streamline Build and Release.
Advanced Windows 8 Apps Using JavaScript Jump Start Exam Prep M6: Deployment Jeremy Foster Microsoft Developer Evangelist Michael Palermo Microsoft.
Visual Studio Team System overview Pierre Greborio Software Architect – PEWay Microsoft MVP – Solutions Architect.
Real World SQL Server Data Tools Benjamin
Visual Studio 2012: A Complete IDE (Debugging & Source Control) Kevin Howell.
Continuous Integration for Databases Steve Jones SQLServerCentral Red Gate Software.
Northwest Arkansas.Net User Group Jay Smith Tyson Foods, Inc. Unit Testing nUnit, nUnitAsp, nUnitForms.
Unit Testing with tSQLt
Continuous Delivery and Team Foundation Server 2013 Ognjen Bajić Ana Roje Ivančić Ekobit.
1 Punishment Through Continuous Delivery If it hurts, do it more often…
Developing SQL/Server database in Visual Studio Introducing SQL /Server Data Tools Peter Lu.Net Practices Director Principle Architect Nexient March 19.
Automation Testing Trainer: Eran Ruso. Training Agenda Automation Testing Introduction Microsoft Automation Testing Tool Box Coded UI Test and Unit Test.
Benjamin Unit Testing & Test-Driven Development for Mere Mortals.
Get testing with tSQLt Practical examples and automation Steve Jones SQLServerCentral Red Gate Software.
Avoiding the Pitfalls of Database Change Automation Cindy Bean Sr. Software Consultant DBmaestro SQLSaturday #514 – Houston, May 14, 2016.
Others Talk, We Listen. Managing Database Projects in Visual Studio 2013.
Continuous Integration for Databases Steve Jones SQLServerCentral Red Gate Software.
Tools and technology usage in PFMS application lifecycle management process LEPL Financial-Analytical Service, Ministry of Finance October, 2015 Dimitri.
Automated Build and Test
Introduction ITEC 420.
Building Enterprise Applications Using Visual Studio®
Build Fundamentals and Continuous Integration
Visual Studio Database Tools (aka SQL Server Data Tools)
Making Your List and Checking It Twice
Introduction to unit and integration testing with tSQLt
Team Foundation Server – Build-Deploy-Test Workflow
Module 1: Getting Started
Unit Testing & Test-Driven Development for Mere Mortals
SQL Server Data Tools Gert Drapers
Continuous Integration For Databases
Prove to your boss your database is sound - Unit Testing with tSQLt
Intro to Unit Testing with tSQLt
Visual Studio Database Tools (aka SQL Server Data Tools)
Quality Assurance in an Agile Development Team Michelle Wu 2018 PNSQC
DAT381 Team Development with SQL Server 2005
Your code is not just…your code
SSDT and Database Project Basics
What about the Data Dude?
SSDT, Docker, and (Azure) DevOps
Office 365 Development July 2014.
SSDT, Docker, and (Azure) DevOps
PNW SQL Users Group August 10th, 2011
SSDT, Docker, and (Azure) DevOps
Your code is not just…your code
Samir Behara, Senior Developer, EBSCO
Presentation transcript:

#sqlsatPordenone #sqlsat367 February 28, 2015 Testing your databases Alessandro

#sqlsatPordenone #sqlsat367 February 28, 2015 Sponsors

#sqlsatPordenone #sqlsat367 February 28, 2015 Organizers

#sqlsatPordenone #sqlsat367 February 28, 2015 About me  SQL Server MVP since 2008  Microsoft Certified  blogs:  [ITA]  [ENG]  More details on: 

#sqlsatPordenone #sqlsat367 February 28, 2015 Agenda  ALM/DLM concepts  Unit Testing concepts  Why Unit Testing on databases  Unit Testing frameworks  Unit Testing solutions  Conclusions  Q&A

#sqlsatPordenone #sqlsat367 February 28, 2015 ALM definition ALM is the product lifecycle management (governance, development, and maintenance) of application software. It encompasses requirements management, software architecture, computer programming, software testing, software maintenance, change management, project management, and release management. (source: Wikipedia)

#sqlsatPordenone #sqlsat367 February 28, 2015 Why ALM?  Breaking the team barriers (integration)  Release high quality software  Release software in quickly way  Customer satisfaction  Improved work organization  Monitoring and tracking the activities  Improved code (clear and easy to read)

#sqlsatPordenone #sqlsat367 February 28, 2015 How to reach the best Quality?  Continuous Integration!  DEVELOP  SEND  BUILD  TEST

#sqlsatPordenone #sqlsat367 February 28, 2015 DLM – Database lifecycle management DLM is a comprehensive approach to managing the database schema, data, and metadata for a database application. DLM begins with discussion of project design and intent, continues with database develop, test, build, deploy, maintain, monitor, and backup activities, and ends with data archive. (source: TechNet)

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing 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)

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – Why?

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – Why?  Mission-critical business functionality  Evolutionary development  Usage of mock/fake objects  We’re missing bugs  We’re missing potential regressions

#sqlsatPordenone #sqlsat367 February 28, 2015 Then.. «Fix bugs as soon as you find them»  Unfixed bugs camouflage other bugs  Unfixed bugs suggest quality isn’t important  Discussing unfixed bugs is a waste of time  Unfixed bugs lead to duplicate effort

#sqlsatPordenone #sqlsat367 February 28, 2015 Lesson learned..  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

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – What we usually do?  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

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – What do I test?  Calculations in procedures and functions  Constraints (schema)  Edge cases of data DML  Expected behavior of data DML  Error Handling  Security  Standards

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – What can we use?  Frameworks  tSQLt  tSQLUnit  SQLCop  SS-Unit  Tools  SQLTest by Red-Gate (tSQLt + SQLCop)  Unit test project with Visual Studio

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – tSQLt  Free framework (open source)  T-SQL  Requires SQLCLR to be enabled  Includes common assertions  Self-contained tests  Isolated transactions  Versatile  Similar to xUnit

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – tSQLt structures  Built-in  tsqlt schema  Classes  Group of stored procedures (tests)  Model  Assemble (create fakes)  Act (apply logics)  Assert (verify results)  Conventions  Naming: test*

#sqlsatPordenone #sqlsat367 February 28, 2015 DEMO 1 tSQLt and Red-Gate SQL Test +

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – Visual Studio  Visual Studio Data Tools  Unit test projects (created by template) .Net + T-SQL  Supported also in VS 2013  Integrated Test UI (Test Explorer)  UI for test conditions  Pre/Post test scripts

#sqlsatPordenone #sqlsat367 February 28, 2015 DEMO 2 Visual Studio database unit testing projects +

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – tSQLUnit  Free framework (open source)  T-SQL and SSMS  Self-contained tests  Isolated transactions  Versatile  Setup and reset  Similar to xUnit tSQLUnit

#sqlsatPordenone #sqlsat367 February 28, 2015 Unit testing – tSQLUnit structures  TestSuites  Is the name after ut_ prefix  Groups of procedures  User defined test (prefix ut_)  ut_TestSuiteName_WhatToDo  Built-in  tsu_ procedures  Fixtures  _setup procedures  ut_TestSuiteName_setup  _teardown procedures  ut_TestSuiteName_teardown  They execute for each test in the suite tSQLUnit

#sqlsatPordenone #sqlsat367 February 28, 2015 DEMO 3 tSQLUnit in SQL Server Management Studio tSQLUnit +

#sqlsatPordenone #sqlsat367 February 28, 2015 Features comparison – SQL Test  Pros  SSMS integration  Class execution  Messages and icons (UI)  T-SQL oriented  Self-contained  Supports tSQLt and SQLCop  Cons  Ui to be improved  Installs a set of objects  Needs SQLCLR  Needs TRUSTWORTHY ON

#sqlsatPordenone #sqlsat367 February 28, 2015 Features comparison – Visual Studio  Pros  Visual Studio  Future support of project templates  Improved UI and designers  Does not need to add objects to database  Cons  Test project is not so comfortable  Test framework is not written in T-SQL  Out of SSMS (is this really a Con? )  Different approaches on past VS versions

#sqlsatPordenone #sqlsat367 February 28, 2015 Features comparison – tSQLUnit  Pros  T-SQL oriented  Based on well known xUnit framework  Does not need SQLCLR  Open source  Cons  No UI  Installs a set of objects on the database  Poor T-SQL based documentation tSQLUnit

#sqlsatPordenone #sqlsat367 February 28, 2015 Conclusions  There is no excuse for NOT testing like any other piece of code  Tools exist for testing  Tools exist for generating data  Testing processes improve the quality

#sqlsatPordenone #sqlsat367 February 28, 2015 Resources (VS 2010) unit-testing-in-ssdt.aspxhttp://blogs.msdn.com/b/ssdt/archive/2012/12/07/getting-started-with-sql-server-database- unit-testing-in-ssdt.aspx (SSDT) (VS 2012) (VS 2013) (Article on CI) (DLM) tsqlt/ (PL-SQL)

#sqlsatPordenone #sqlsat367 February 28, 2015 Q&A  Questions?

#sqlsatPordenone #sqlsat367 February 28, 2015 THANKS! SpeakerScore #sqlsatPordenone #sqlsat367