Automated Build and Test

Slides:



Advertisements
Similar presentations
Black marble the strategic IT asset for your organisation DEVELOPMENT LIFE CYCLE USING VISUAL STUDIO TEAM EDITION FOR DB PROFESSIONALS Richard Fennell.
Advertisements

Development Life Cycle using Visual Studio Team Edition for DB Professionals Richard Fennell Engineering Director SQLBits II Birmingham 1 st March 2008.
#sqlsatPordenone #sqlsat367 February 28, 2015 Testing your databases Alessandro
Improving Software Quality with Continuous Integration
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.
#RefreshCache CI - Daily Builds w/Jenkins – an Open Source Continuous Integration Server Nick Airdo Community Developer Advocate Central Christian Church.
By John Boal  Continuous Integration [CI] ◦ Automating the build process ◦ Build the entire system each time any new.
CONTINUOUS INTEGRATION, DELIVERY & DEPLOYMENT ONE CLICK DELIVERY.
THE CONTINUOUS DELIVERY ZONE Craig Berntson Chief Software Gardener Mojo Software Worx.
Continuous Integration and Testing
Craig Berntson
Sumedha Rubasinghe October,2009 Introduction to Programming Tools.
& Dev Ops. Sherwin-Williams & DevOps Introduction to Sherwin-Williams.
Database Change Management One solution to an often complex problem Kevin Hurwitz Headspring Systems
Build Processes and Continuous Integration Automating Build Processes Software University Technical Trainers SoftUni Team.
Sofia Event Center May 2014 Branimir Giurov C# MVP Solution Architect BulPros Consulting Continuous Integration of Sharepoint 2013 Solutions with.
Build automation. Prerequisites for Continuous Integration (CI)  Version Control System  Build automation  Notification on build result sent to related.
Continuous Integration for Databases Steve Jones SQLServerCentral Red Gate Software.
Continuous Deployments using SSDT
Get testing with tSQLt Practical examples and automation Steve Jones SQLServerCentral Red Gate Software.
Others Talk, We Listen. Managing Database Projects in Visual Studio 2013.
DevOps in the cloud Peter’s personal journey on how I found out, I need Dev skills to optimize my ‘Azure’ work… and so do you!!
Continuous Integration for Databases Steve Jones SQLServerCentral Red Gate Software.
DevOps with ASP.NET Core and Entity Framework Core
Analysis Services in times of Continuous Integration
Bringing DevOps to the Database
Bringing DevOps to the Database
Joonas Sirén, Technology Architect, Emerging Technologies Accenture
Stress Free Deployments with Octopus Deploy
Continuous Deployment
Visual Studio Database Tools (aka SQL Server Data Tools)
Continuous Deployments using SSDT
Continuous Integration and Testing
Delphi or C++ Builder, with Subversion and Jenkins
Bringing DevOps to the Database
8/8/ :43 PM THR3079 Moving from application automation to true DevOps by including the database Tom Austin Head of Pre Sales Engineering © Microsoft.
Team Foundation Server – Build-Deploy-Test Workflow
Build /21/2018 © 2015 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION.
Bringing DevOps to the Database
SQL Server Data Tools Gert Drapers
Continuous Integration For Databases
X in [Integration, Delivery, Deployment]
Microsoft /12/2018 8:06 AM BRK2103 Deliver more features faster with a modern development and test solution Claude Remillard Group Program Manager.
Dev Test on Windows Azure Solution in a Box
持續的產出Windows Azure 雲端服務
03 | Continuous Deployment
Intro to Unit Testing with tSQLt
Visual Studio Database Tools (aka SQL Server Data Tools)
Continuous Deployments using SSDT
Bringing DevOps to the Database
Continuous Deployments using SSDT
Continuous Localization
Continuous Deployments using SSDT
Delivering Business Value Faster
DAT381 Team Development with SQL Server 2005
Your code is not just…your code
Presented by : Chirag Dani & Dhaval Shah
Introduction to VSTS Database Professional
Delivering Business Value Faster
SSDT, Docker, and (Azure) DevOps
SSDT, Docker, and (Azure) DevOps
Erik Vollebekk Application Architect
Adopting a Compliant Database DevOps Process
The Future of Database Development
Adopting a Compliant Database DevOps Process
The Future of Database Development
Jamie Cool Program Manager Microsoft
SSDT, Docker, and (Azure) DevOps
Your code is not just…your code
The Future of Database Development (with containers)
Presentation transcript:

Automated Build and Test Steve Jones SQLServerCentral Red Gate Software Start VM - Open SSMS, connect to dev database - Open VS, get project open for ST - Open Subversion explorer - Open Chrome – Team City console. - open data generator, connect to database - run website project Zoomit Close SQLTest databases not in use

Agenda Goals Who am I? What is Continuous Integration? Fitting in the Delivery Pipeline What is “build” for databases? Testing in a CI process Adding data for realism

Do feel free to ask questions! Goals Why continuous integration? Testing is important It’s easy – setup and running in an hour Do feel free to ask questions!

Get in touch Steve Jones www.voiceofthedba.com @way0utwest sjones@sqlservercentral.com @way0utwest /in/way0utwest

Jez Humble, ThoughtWorks, author of “Continuous Delivery” What is continuous integration? “Continuous Integration is a practice designed to ensure that your software is always working, and that you get comprehensive feedback in a few minutes as to whether any given change to your system has broken it.” Jez Humble, ThoughtWorks, author of “Continuous Delivery”

Jez Humble, ThoughtWorks, author of “Continuous Delivery” What is continuous integration? database ^ “Database Continuous Integration is a practice designed to ensure that your database software is always working, and that you get comprehensive feedback in a few minutes as to whether any given change to your system has broken it.” Jez Humble, ThoughtWorks, author of “Continuous Delivery”

Database release pipeline Development Continuous Integration Testing Production Database development and change management Operations QA / Test / Pre-production Continuous integration ALTER TABLE foo… Review, Backup & deploy Build Test Trigger Deployment script Source control Sync Release management Production Publish Artifact repository Development Continuous delivery for databases

Database release pipeline Development Continuous Integration Testing Production Database development and change management Operations Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases SalesApp Dev Trunk SalesApp Dev Bug Fixes Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases

Database release pipeline Development Continuous Integration Testing Production Database development and change management Operations SalesApp Dev Trunk Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases SalesApp Dev Bug Fixes Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases Development Continuous integration Build Test Publish Sync ALTER TABLE foo… Deployment script Release management Artifact repository Production Trigger Review, Backup & deploy Source control QA / Test / Pre-production Continuous delivery for databases Finance Dev Trunk

Continuous Integration

What is build? For application code = compile For database code = database creation script But only for a new installation! Upgrade scripts required for existing installations Need to preserve the state of the data The testing of deployment scripts is customarily left to the end. => Issues with upgrades only found at the end of a project.

Tools we need CI server Choices Perform the build for us Execute steps we program Choices TeamCity by JetBrains Jenkins – open source Bamboo – Atlassian TFS Build - Microsoft Cruise Control – open source Show of hands for SQL Developer Bundle. TeamCity is used at Red Gate but *any* build server can be used, eg: Jenkins, Hudson, TFS Build, CruiseControl, Bamboo, etc. There is a sqlci.exe command line, and NAnt and MSBuild template wrappers available.

Tools we need Database Integration Choices Check out schema from VCS Execute against a SQL Server instance. Run tests Deploy to Integration Choices Red Gate DLM Automation Suite PoSh .NET scripts/program ? Show of hands for SQL Developer Bundle. TeamCity is used at Red Gate but *any* build server can be used, eg: Jenkins, Hudson, TFS Build, CruiseControl, Bamboo, etc. There is a sqlci.exe command line, and NAnt and MSBuild template wrappers available.

Tools we need Version Control System (VCS) Choices Store our database DDL and DML Choices Subversion Team Foundation Server Git Mercurial Visual SourceSafe etc Show of hands for SQL Developer Bundle. TeamCity is used at Red Gate but *any* build server can be used, eg: Jenkins, Hudson, TFS Build, CruiseControl, Bamboo, etc. There is a sqlci.exe command line, and NAnt and MSBuild template wrappers available.

Tools we need Testing framework Choices We need a way to unit test our code easily. A framework allows us to write tests that we can maintain Choices tSQLt and SQL Test Microsoft Unit Tests TSQLUnit TST DBUnit

Tools we need Test data Choices Add known or random data to our CI database. Choices Red Gate SQL Data Generator Restore known backup Custom scripts for data load (DML and/or BCP) Show of hands for SQL Developer Bundle. TeamCity is used at Red Gate but *any* build server can be used, eg: Jenkins, Hudson, TFS Build, CruiseControl, Bamboo, etc. There is a sqlci.exe command line, and NAnt and MSBuild template wrappers available.

Our story… We want to set up a CI process for our database Our database is in a VCS We need to automatically build a new database on every check-in Needs a new name, but this is where we talk about our demo app slightly (or code). Give a first requirement we need to do.

Demo Continuous Integration Setup and data change Setup CI Server project Setup Build Step Setup Sync Step

The CI Database Setup Repository CI Server Integration Database Developer Integration Database

The CI Database Setup Repository CI Server Integration Database Developer Integration Database

The CI Database Setup CI Process Repository CI Server Nuget Pkg SimpleTalkDB Developer Integration Database

The CI Database Setup CI Process Repository CI Server Nuget Pkg SimpleTalkDB Developer Random Test Database Integration Database

The CI Database Setup CI Process Repository Build Database from Scratch and validate CI Server Nuget Pkg SimpleTalkDB Developer Random Test Database Integration Database

The CI Database Setup CI Process Repository Apply Upgrade CI Server Nuget Pkg SimpleTalkDB Developer Integration Database

Keeping a database up to date With? Schema Static data Why? A corresponding database for the application Maintaining a test database with the latest changes

Why it’s important Testing

Where does testing happen? Testing isn’t just done in QA Be aware of the cost of fixing a bug There are pre-dev phases where testing could also happen –requirements analysis, architecture, functional specification.

Cost of Bugs

Does the cost of bugs rise?

Testing in Development Low(er) costs No inter-team interactions Changes are discrete However Increased frequency of changes (higher cost) Testing in development is preferred as the costs as low, or relatively low compared to finding bugs and issues later. The lower costs come because testing is done in one team, or with one person. The changes are also discrete in that there aren’t a large bundle of changes being put together over time for deployment. Small bits of change are occurring. However there are more changes, which means more costs to the tests and running a suite of tests. The key here is automation.

What is test? For .NET code, Nunit Runs on a developer’s machine and build server What about the database? tSQLt is an open source framework for testing SQL Server databases tSQLt.org Support via GoogleGroups SQL Test provides SSMS integration Although CI catches issues that arise when developers have failed run tests locally, also solving a different problem: - Two incompatible changes committed by different developers - “Works on my machine” in development. Issues that only arise in more realistic integration environments.

Our story… We want to set up a CI process for our database Our database is in a VCS We need to automatically build a new database on every check-in Let’s add a unit test for our code to the CI process. Needs a new name, but this is where we talk about our demo app slightly (or code). Give a first requirement we need to do.

Demo Testing the Build Add a test step to the build Add a test Add a dev change to verify sync

Why generate test data? Dev environments are often not realistic Getting production data not always possible Random data can result in surprises Volume testing can find performance issues

Our story… We want to set up a CI process for our database Our database is in a VCS We need to automatically build a new database on every check-in Let’s add a unit test for our code to the CI process. Let’s generate test data to use in our CI process Needs a new name, but this is where we talk about our demo app slightly (or code). Give a first requirement we need to do.

Demo Testing with larger data sizes Change the Test step to generate data Build a data generation project Trigger the build

Two bugs found by Test Data NULL Dates App code assumed [Date] wouldn’t be NULL Test data didn’t Fix was to change [Date] to be NOT NULL Performance of v_Articles Test passed on dev box Failed in more “realistic” CI environment

Deployments Scripts Creation scripts For new installations Upgrade Scripts For existing installations Developed by comparing our up-to-date database to production/test Creates database packages, used for reliable and repeatable deployments

Database release pipeline Development Continuous Integration Testing Production Database development and change management Operations QA / Test / Pre-production Continuous integration ALTER TABLE foo… Review, Backup & deploy Build Test Trigger Deployment script Source control Sync Release management Production Publish Artifact repository Development Continuous delivery for databases

The End Questions? More information: www.red-gate.com/CI Please fill out your feedback forms http://voiceofthedba.wordpress.com/ sjones@sqlservercentral.com @way0utwest /in/way0utwest

References http://assets.red-gate.com/products/sql-development/assets/continuous-integration-using-red-gate-tools.pdf http://www.jetbrains.com/teamcity/ http://developers.slashdot.org/story/03/10/21/0141215/software-defects---do-late-bugs-really-cost-more http://tech.lds.org/index.php?option=com_content&view=article&id=238:the-cost-of-bugs&catid=1:miscellanous http://www.manageware.co.il/solution/portfolio/auto-deploy/