<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Devin Gleason-Lambert on Medium]]></title>
        <description><![CDATA[Stories by Devin Gleason-Lambert on Medium]]></description>
        <link>https://medium.com/@devingleasonlambert?source=rss-aef6ad031464------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TfZH3uNLAfelj_Kz.</url>
            <title>Stories by Devin Gleason-Lambert on Medium</title>
            <link>https://medium.com/@devingleasonlambert?source=rss-aef6ad031464------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 11:28:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devingleasonlambert/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Test-Driven Development by Example, Using PowerShell — Setting up your local environment]]></title>
            <link>https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-setting-up-your-local-environment-b7455fbf80a4?source=rss-aef6ad031464------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7455fbf80a4</guid>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[pester]]></category>
            <dc:creator><![CDATA[Devin Gleason-Lambert]]></dc:creator>
            <pubDate>Sat, 06 Feb 2021 16:09:25 GMT</pubDate>
            <atom:updated>2021-02-06T16:09:25.312Z</atom:updated>
            <content:encoded><![CDATA[<h3>Test-Driven Development by Example, Using PowerShell — Setting up your local environment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-b-RzooS0FgPWh81KW4UQ.png" /></figure><p>In the post, I will cover the setup of our local environment to support unit testing our PowerShell code.</p><p>If you prefer to watch this as a video, I’ve recorded it on <a href="https://youtu.be/2SGKL9XPPJE">Youtube</a>.</p><p>First, I am setting up a directory, and a git repository, so I can track the changes we make in each chapter.</p><p>Open Powershell and enter the following commands.</p><pre>&gt; cd c:\<br>&gt; mkdir TDD<br>&gt; cd .\TDD<br>&gt; git init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*eqQRNad4JacAxKigyG5B2w.png" /></figure><p>I am now ready to install Pester. If your not familiar w/ Pester. It is the Powershell framework that allows us to write and execute unit tests against our Powershell code.</p><pre>[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12</pre><pre>Install-Module Pester</pre><p>I prefer to save setups like this to file, then run it from there, so then I have it for reference in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*32yEJXgD0GoQKCspMB-PMQ.png" /></figure><p>I execute my install pester.ps1 file, then I add and commit my changes.</p><pre>&gt; git add *<br>&gt; git status<br>&gt; git commit -m &quot;Adding Install Pester Script&quot;<br>&gt; git status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*kr4begCj_OvONc7qgw8kVg.png" /></figure><p>In addition to this, I found it helpful to have a dedicated runner that I could execute separately from my ISE window for running my unit tests. Don’t worry about this file too much right now, all you need to know is that once I have tests, I can use this file to run my tests. Again, I use the same git workflow of adding and committing my changes.</p><pre>Import-Module Pester -Force</pre><pre>$configuration = [PesterConfiguration]::Default;</pre><pre>Invoke-Pester -Configuration $configuration</pre><pre>Read-Host</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*SSNP0ZsGsuOzo6kQJjvqWA.png" /></figure><p>You can find my files at the following GitHub repo — <br><a href="https://github.com/dglambert/powershell-tdd-by-example/tree/local-setup">https://github.com/dglambert/powershell-tdd-by-example/tree/local-setup</a></p><p><strong>In the next article, we dig into the first chapter and writing our tests.</strong></p><ul><li>To go on and read my next post: [LINK PENDING: <strong><em>Test-Driven Development by Example, Using PowerShell — Ch1: Multi-Currency Money </em></strong>— Please feel free to harass me in the comments, as it provides a motive for me to keep writing].</li><li>If you haven’t read my opening post of the series, check it out (2 min): <a href="https://devingleasonlambert.medium.com/test-test-driven-development-by-example-using-powershell-4e462fce2578">Test-Driven Development by Example, Using PowerShell</a></li><li>Or to read my previous post on What TDD is (3 min): <a href="https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-what-is-tdd-9a5006c9931">Test-Driven Development by Example, Using PowerShell — What is TDD?</a></li></ul><ol><li>Kent Beck, Test-Driven Development By Example (Boston, MA: Pearson Education, Inc, 2003), ix</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7455fbf80a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test-Driven Development by Example, using Powershell — What is TDD?]]></title>
            <link>https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-what-is-tdd-9a5006c9931?source=rss-aef6ad031464------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a5006c9931</guid>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[tdd]]></category>
            <dc:creator><![CDATA[Devin Gleason-Lambert]]></dc:creator>
            <pubDate>Sat, 23 Jan 2021 17:28:50 GMT</pubDate>
            <atom:updated>2021-02-06T16:10:35.977Z</atom:updated>
            <content:encoded><![CDATA[<h3>Test-Driven Development by Example, Using PowerShell — What is TDD?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNQqkRsv5G8a_D58l9PJ5w.png" /></figure><p>Now you may be thinking, this all sounds great, but what exactly is TDD anyway?</p><p>Kent describes only two behaviors necessary for TDD.</p><blockquote>1. Write new Code only if an automated test has failed.</blockquote><blockquote>2. Eliminate duplication.¹</blockquote><p>These behaviors result in the following side effects.</p><blockquote>- We must design organically, with running code providing feedback between decisions.¹</blockquote><p>AKA, we make small changes toward our end goal, and the tests act as our navigation system.</p><blockquote>- We must write our own tests, because we can’t wait 20 times per day for someone else to write a test.¹</blockquote><p>In my previous article, I make a point of DevOps not getting the benefit of Manual QA. This being the case, you’re not likely to be getting any assistance writing automated test cases.</p><blockquote>- Our development environment must provide rapid response to small changes.²</blockquote><p>This point is actually the premise of this whole series. I thought to myself, scripting languages are more rapid than their sibling compiled languages. So what is stopping me from doing TDD?</p><blockquote>- Our designs must consist of many highly cohesive, loosely coupled components, just to make testing easy.²</blockquote><p>My main reason for writing unit tests historically has not been for the coverage, but this point. The inconvenience of writing testable dirty code is too great, so you are forced to write clean and loosely coupled code.</p><p>To simplify, Kent defines the “TDD Mantra” — Red/Green/Refactor.</p><blockquote>- Red — Write a little test that doesn’t work, ̵a̵n̵d̵ ̵p̵e̵r̵h̵a̵p̵s̵ ̵d̵o̵e̵s̵n̵’̵t̵ ̵e̵v̵e̵n̵t̵ ̵c̵o̵m̵p̵i̵l̵e̵ ̵a̵t̵ ̵f̵i̵r̵s̵t̵.̵</blockquote><blockquote>- Green — Make the test work quickly, committing whatever sins necessary in the process.</blockquote><blockquote>- Refactor — Eliminate all of the duplication created in merely getting the test to work.²</blockquote><p>The only obvious modification here for Powershell is the lack of compiling. Aside from this, we are 100% capable of doing TDD with Powershell, No Excuses!</p><p>So to put that another way. You take one of your requirements and make it into a test (Red). You then get to implement the requirement (Green). Then before you repeat the process, you take a moment to clean off your work surface (Refactor).</p><p>It’s that simple, and it’s a beautiful thing.</p><p><strong>I hope you’ve enjoyed my explanation of What TDD Is.</strong></p><ul><li>To go on and read my next post (3 min): <a href="https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-setting-up-your-local-environment-b7455fbf80a4">Test-Driven Development by Example, Using PowerShell — Setting up your local environment</a>.</li><li>If you haven’t read my opening post of the series, check it out (2 min): <a href="https://devingleasonlambert.medium.com/test-test-driven-development-by-example-using-powershell-4e462fce2578">Test-Driven Development by Example, Using PowerShell</a></li><li>Or to read my previous post on WHY you should be using TDD with DevOps (3 min): <a href="https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-preface-introduction-why-you-should-be-dfcf5cff67be">Test-Driven Development by Example, Using PowerShell — Preface &amp; Introduction — Why you should be using TDD with your DevOps practice?</a></li></ul><ol><li>Kent Beck, Test-Driven Development By Example (Boston, MA: Pearson Education, Inc, 2003), ix</li><li>Beck, Test-Driven Development, x</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a5006c9931" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test-Driven Development by Example, using Powershell — Preface & Introduction — Why you should be…]]></title>
            <link>https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-preface-introduction-why-you-should-be-dfcf5cff67be?source=rss-aef6ad031464------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfcf5cff67be</guid>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Devin Gleason-Lambert]]></dc:creator>
            <pubDate>Fri, 22 Jan 2021 00:46:07 GMT</pubDate>
            <atom:updated>2021-01-23T17:37:57.067Z</atom:updated>
            <content:encoded><![CDATA[<h3>Test-Driven Development by Example, Using PowerShell — Preface &amp; Introduction — Why you should be using TDD with your DevOps practice?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IR4oY5driiSvgFTcOzmgvQ.jpeg" /></figure><p>Since there is no code in the beginning sections, there nothing I can say of value regarding doing TDD with Powershell. However, I do see some points worth noting regarding the wider DevOps practice in general.</p><p>At first glance, the whole concept of TDD may strike you as superfluous, especially if you’ve been writing Infrastructure as Code, warm-up scripts, and Slack integration.</p><p><strong>Reason #1 — It’s more important than you think.</strong></p><blockquote>The goal of Test-Driven Development, is to produce Clean Code that works.¹</blockquote><p>One of the feelings I regularly need to quell as a DevOps Engineer is — irrelevance. <br>Your just writing operations code, after all, your not actually writing functional code that’s going into your company’s product. Don’t be silly, your code should be held to as high, if not a higher standard than the product code (See Reason #4). It’s far too easy to write off what you&#39;re doing as inconsequential, don’t let this be an excuse to not exercise good practices.</p><p><strong>Reason #2 — It’s bigger than you think.</strong></p><p>The author does not point this out but hear me out. I felt this way at first too, after all my background is Product Development, not DevOps! How can you really justify writing unit tests for that tiny \scripts\ folder in your repo that “just helps with the deployments”. But give it time, our solution now has 200+ scripts that have grown into a whole slew of functionality that helps our companies IT Org operate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*sFF7VT1jZW99EvcYHj62Sw.png" /><figcaption>220 Powershell files in our repo</figcaption></figure><p><strong>Reason #3 — DevOps Teams don’t get manual QA.</strong></p><blockquote>It lets you know when you’ve finished, without having to worry about if you created bugs.¹</blockquote><p>DevOps is a bit of a gray area when it comes to formal QA. We don’t make changes to the functionality of the product, and if we do we’re refactoring and the functionality should already be covered by automated regression. But it is still code, and is susceptible to unintended behaviors, so TDD is a great way to guard yourself against introducing bugs.</p><p><strong>Reason #4 — DevOps code is the successor to documentation.</strong></p><blockquote>It improves the lives of the users of your software.</blockquote><blockquote>It lets your teammates count on you, and you on them¹.</blockquote><p>The users of our software are the developer and they are our teammates, so it&#39;s a twofer! The code we write is a direct replacement for a process that is being done manually by a developer. So if you can make your code readable and functional, then you’ve effectively killed the need for documenting that process. Your welcome developers!</p><p><strong>I hope you’ve enjoyed my explanation for Why you should be using TDD with your DevOps Practice.</strong></p><ul><li>If you haven’t read my opening post of the series, check it out (2 min): <a href="https://devingleasonlambert.medium.com/test-test-driven-development-by-example-using-powershell-4e462fce2578">Test-Driven Development by Example, Using PowerShell</a></li><li>Otherwise, go on and read my next post (3 min): <a href="https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-what-is-tdd-9a5006c9931"><em>Test-Driven Development by Example, Using PowerShell— What is TDD?</em></a></li></ul><p>A quick note on the author’s mention of Courage and Fear. Kent describes fear as it is seen through the lens of a typical developer, before changing a piece of code that piece of a larger solution. However, what I have experienced as a DevOps, is the opposite. The majority of the time, we are writing something from scratch. That being said, we need to combat the opposite, arrogance or nonchalance about the work that we do. As I point out in my reasons above, don’t let the size or perception of what your working on stop you from taking best practices.</p><p>Cheers,</p><p>Devin</p><ol><li>Kent Beck, Test-Driven Development By Example (Boston, MA: Pearson Education, Inc, 2003), ix</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfcf5cff67be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test-Test-Driven Development by Example using Powershell]]></title>
            <link>https://devingleasonlambert.medium.com/test-test-driven-development-by-example-using-powershell-4e462fce2578?source=rss-aef6ad031464------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e462fce2578</guid>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Devin Gleason-Lambert]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 23:00:24 GMT</pubDate>
            <atom:updated>2021-01-23T17:05:50.557Z</atom:updated>
            <content:encoded><![CDATA[<h3>Test-Driven Development by Example, Using PowerShell</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IR4oY5driiSvgFTcOzmgvQ.jpeg" /><figcaption>Test-Driven Development By Example. By Kent Beck</figcaption></figure><p>Hello All,</p><p>This is my first entry in a series of book reviews of the book Test-Driven Development by Example, written by Kent Beck. However I’ve added a twist, as I will be attempting to do the examples using Powershell.</p><p>A little background; I’m a classically trained C# developer, where Object Orientation and Unit Testing are considered first class citizens. I also lead a small team of developers; we are a Solution Architect, a Senior Web Developer, a DevOps Engineer, and an Automation Engineer. I regularly pick a programming text for us to read each quarter to read as a group to hone our skills. However the material can be a bit of a challenge given our heterogeneous nature.</p><p>As we wrap up on Clean Code by “Uncle” Bob Martin, I am starting to read ahead, searching for our next entry. So when I decided on Kent Beck’s TDD classic, I thought, it would be fun exercise to do TDD w/ Powershell. However as I start to notice some of the challenges of practicing TDD using Powershell, I decided to blog my experience in a series of articles. I will do my best to share my learnings with you as I progress.</p><p>I hope you enjoy!</p><p>Cheers,</p><p>Devin</p><p>Check out my next article in this series on Why you should be using TDD with DevOps (3 min): <a href="https://devingleasonlambert.medium.com/test-driven-development-by-example-using-powershell-preface-introduction-why-you-should-be-dfcf5cff67be">Test-Driven Development by Example, Using PowerShell — Preface &amp; Introduction — Why you should be using TDD with your DevOps practice?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e462fce2578" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>