Turning Your Checklists

Slides:



Advertisements
Similar presentations
11-Jun-14 The assert statement. 2 About the assert statement The purpose of the assert statement is to give you a way to catch program errors early The.
Advertisements

Detecting Bugs Using Assertions Ben Scribner. Defining the Problem  Bugs exist  Unexpected errors happen Hardware failures Loss of data Data may exist.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 15: Exception Handling.
Chapter 16: Exception Handling C++ Programming: From Problem Analysis to Program Design, Fifth Edition.
DAIMI(c) Henrik Bærbak Christensen1 JUnit A tool for test case management.
1 Advanced Material The following slides contain advanced material and are optional.
SharePoint 2010 Development Environment A Guide to Setup SharePoint 2010 Development Environment on Windows 7 Machine.
Trevor Sullivan Solution Architect Project Leadership Associates.
Guide to Linux Installation and Administration, 2e1 Chapter 7 The Role of the System Administrator.
Exceptions Handling Exceptionally Sticky Problems.
Upgrading to SQL Server 2000 Kashef Mughal. Multiple Versions SQL Server 2000 supports multiple versions of SQL Server on the same machine It does that.
Chapter 14: Exception Handling. Objectives In this chapter, you will: – Learn what an exception is – Learn how to handle exceptions within a program –
Project Scenario for OpX. High-level Overview In the Test GUI Controller, opXController, for the opX command there is conceptually a call to an appropriate.
Chapter 15: Exception Handling C++ Programming: Program Design Including Data Structures, Fifth Edition.
ICS3U_FileIO.ppt File Input/Output (I/O)‏ ICS3U_FileIO.ppt File I/O Declare a file object File myFile = new File("billy.txt"); a file object whose name.
Rob Sewell Making PowerShell Useful Real-Life Examples of Powershell in Action Slides available here -
Using Power BI with my DBA Database
Automated Testing with PHPUnit. How do you know your code works?
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
Validation Controls Assist your users with providing the correct type of input for your application Assist your users with providing the correct type of.
CS 330 Class 7 Comments on Exam Programming plan for today:
Topic: Programming Languages and their Evolution + Intro to Scratch
Achieve more in less time using the new SQL PowerShell
Handling Exceptionally Sticky Problems
Introduction to JUnit CS 4501 / 6501 Software Testing
Deploying and Configuring SSIS Packages
[+] Title Should Be 'Introduction to Pester‘ 89ms
Simplifying XEvents Management with dbatools
Chapter 14: Exception Handling
Administrating SQL Server with PowerShell dbatools
Introduction to PowerShell
Reliable, Repeatable, Configurable & Automated Validation with
Administrating SQL Server with PowerShell dbatools
Making PowerShell Useful
dbachecks! DBA Checklists: Reliable, Repeatable, & Automated
Administrating SSRS without boring web based clicks!
"SessionTitle": "Infrastructure as Code"
Testing in PowerShell Powered by Pester NATHAN ZIEHNERT 5/25/2018.
SQL Saturday #654 - Omaha.
Making PowerShell Useful
Chrissy LeMaire, MVP & Rob Sewell, MVP
Unit testing for your database infrastructure
SQL Saturday #662 - Sioux Falls, SD Hosted by (605) SQL
Getting started with Powershell for the DBA
Reliable, Repeatable, Configurable & Automated Validation with
PowerShell & PowerBi Reducing DBAs Context Switching
Making PowerShell Useful
PowerShell Best Practices for SQL DBA’s
PowerShell & PowerBi Reducing DBAs Context Switching
PowerShell & PowerBi Reducing DBAs Context Switching
Making PowerShell Useful
SQLSERVER:\ Using the SQL Server Provider with PowerShell
Automating the install and upgrade of SQL scripts
PowerShell & PowerBi Reducing DBAs Context Switching
Commands for SQL Server
PowerShell SQL Server I will be tweeting links as we go
The 6 P’s Powershell Profile Prepares Perfect Production Purlieu
The 6 P’s Powershell Profile Prepares Perfect Production Purlieu
The 6 P’s Powershell Profile Prepares Perfect Production Purlieu
Start testing your SSIS packages with ssisUnit
Administrating SQL Server with PowerShell dbatools
Test and Verify Instances with DBAchecks
Reliable, Repeatable, Configurable & Automated Validation with
Lecture 12: The Fetch Api and AJAx
Administrating SQL Server with PowerShell dbatools
Chapter 3: Selection Structures: Making Decisions
Handling Exceptionally Sticky Problems
Managing and monitoring SQL Server on Linux from the command line
Life Hacks: dbatools Edition
Unit Testing.
Presentation transcript:

Turning Your Checklists [+] Green is Good 558ms [-] Red is Bad 168ms Turning Your Checklists into Pester Tests Rob Sewell @sqldbawithbeard https://sqldbawithAbeard.com

speaker questionnaire Name : Rob Occupation : DBA, Automator, Do-er, Trainer, DevOpser! Available for hire  - RobSewell.info Interests : PowerShell, Automation And SQL (PaaS geddit?) Interesting Fact : Beard. (Still) Plays Cricket, Flies Drone Speaker : SQL Saturdays, SQL Relay, PowerShell Events Community : SQL South West , SQL Sat Exeter , PowerShell VG, PowerShell Conference EU Organiser, dbareports, dbatools, SQLDiagAPI – For Consuming SQL Server Diagnostics API, MVP Crashes

TODAY’s TO DO LIST GET UP Drink Appropriate Liquid The Rest

How Many Checklists Do You Have? I bet there are checklists for New servers/ data centers Hardware/software installations Incident Response 1st Line/2nd line for systems Pre-requisites Morning routines

I‘m sure you are already thinking of more What about Demos Presentations Morning Checks Incident Response First Line Support I‘m sure you are already thinking of more

What is Pester? Pester provides a framework for running unit tests to execute and validate PowerShell commands from within PowerShell Its used for unit testing or TDD but can also be used to validate an environment. Comes with Windows 10 or install from the gallery with Install-Module Pester https://github.com/pester/Pester

What Does it Look Like? This is a Pester test running in VS Code

I’m Sorry!

Should Operators Be Compares one object with another for equality. Case Insensitive BeExactly Compares one object with another for equality. Case Sensitive BeGreaterThan Asserts that a number is greater than an expected value. BeLessThan Asserts that a number is less than an expected value. BeLike Asserts that the actual value matches a wildcard pattern using -like operator. Case Insensitive BeLikeExactly Asserts that the actual value matches a wildcard pattern using -like operator. Case Sensitive BeOfType Asserts that the actual value should be an object of a specified type Exist Does not perform any comparison but checks if the object calling Exist is present in a PS Provider. Contain Checks to see if a file contains the specified text. Case Insensitive ContainExactly Checks to see if a file contains the specified text. Case Sensitive Match Uses a regular expression to compare two objects. Case Insensitive MatchExactly Uses a regular expression to compare two objects. Case Sensitive Throw Checks if an exception was thrown in the input ScriptBlock. BeNullOrEmpty Checks values for null or empty (strings). I Hate slides with lots of text but I think this one is valid

So What Can You Validate? Everything in the world 

Maybe not EVERY thing but anything you can check with PowerShell

dumskalle! Which Does NOT include Maybe not EVERY thing but anything you can check with PowerShell Which Does NOT include Describe “Bag Packing” { Context “Hardware”{ It “Bag Should include BeardNUC” { $bag.Contents –contains ‘beardnuc’ | Should Be $True } I have no virtual machines with me here! dumskalle!

Hey Beardy! Time For A DEMO

Summary We all have checklists – manual testing is error-prone Pester is a Unit Testing Framework for PowerShell You can use it to validate your infrastructure The basic syntax - Describe, Context and It code blocks The Should command is used for testing assertions Use the NunitXML output and the reportviewer.exe to make HTML reports or Export to JSON and use PowerBi Rob Sewell @sqldbawithbeard https://sqldbawithAbeard.com

Questions? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Rob Sewell @sqldbawithbeard https://sqldbawithAbeard.com

Further Reading Adam Bertram – The Pester Book https://leanpub.com/pesterbook Rob Sewell and Andre Kamman at PSConfEU https://www.youtube.com/watch?v=8Nljk1deSmU&t=188s Rob Sewell @sqldbawithbeard https://sqldbawithAbeard.com