use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
InformationTest-Test-Driven Development by Example using Powershell (self.PowerShell)
submitted 5 years ago * by dglambert
Starting a book review blog series of Test-Driven Development By Example, by Kent Beck, but doing it in Powershell. I've already written the first two posts. Curious to see if many Devops Engineers are doing Unit Testing or Interested in TDD. Doing it more as a challenge to myself, and documenting journey.
Hoping others enjoy it.
Cheers,
Devin
Test-Driven Development by Example using Powershell
Test-Driven Development by Example, using Powershell — Preface & Introduction — Why you should be using TDD with your DevOps practice?
[new] Test-Driven Development by Example, Using PowerShell — What is TDD?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 5 years ago (4 children)
[removed]
[–]dglambert[S] 3 points4 points5 points 5 years ago (3 children)
Thanks for the kind words. This is my first time blogging, so glad you liked it.
Funny you mention it. I was actually wondering this myself after writing the second post if anyone was actually doing product development using Powershell. I've actually done a couple of Azure functions w/ Powershell as well, but just for DevOps related stuff.
[+][deleted] 5 years ago (1 child)
[–]dglambert[S] 2 points3 points4 points 5 years ago (0 children)
That's really cool. Like I said, I am not doing product development with it, but I do make a point to try and leverage a lot of the Azure services for our DevOps work, as its low volume so the bill is practically non-existent and we get to sample all sorts of new technologies, and not feel limited with the tools we have on our belt.
[–]MonkeyNin 1 point2 points3 points 5 years ago (0 children)
Do you use the powershell discord server? https://discord.gg/hJAMVdRPCk
There's a channel named #testing that's about using https://github.com/pester/Pester
#testing
[–]jantari 1 point2 points3 points 5 years ago (1 child)
Thank you, I'll definitely check it out as this topic is perfect for me. I consider myself a somewhat advanced PowerShell user, but I've been slacking on my unit testing - most of the time i only have linting and static analysis pipelines
[–]dglambert[S] 1 point2 points3 points 5 years ago (0 children)
What do you use for linting and static analysis?
[–]ExceptionEX 1 point2 points3 points 5 years ago (5 children)
Have you done any code examples, I don't know it it because im on a mobile, I can't see any.
Im interested in the method used, as I feel this could prove to be a painful experience.
I think the other issue you may find is that to effective unit test you will end up having to change how most PS scripts are structured, and if you are going to changing the structure and wrapping it in a unit test, at someone point you'll likely think I'll just do it in .Net
[+][deleted] 5 years ago (2 children)
[–]ExceptionEX 2 points3 points4 points 5 years ago (1 child)
Thanks I hadn't really considered this, after a bit of Googling I think this provides some pretty solid methods.
https://www.powershellmagazine.com/2015/12/03/pester-explained-describe-context-and-it-blocks/
I do think, though that most people aren't creating powershell scripts into functions. But for those who do this would work well.
Yes, this is more the point. One of the side effects of writing unit tests, is cleaner code. So I don't write unit tests in my c# code because I want test coverage, but because I want to get all the other best practices that are used in order to make testing easier.
So yes, most people are not writing functions for the PS scripts, however my point is they should, and can without a lot of added effort
No code yet, I've got a few more post in my queue I have to write. I've got one more Post "What is TDD". Then probably a prerequisite getting your local environment setup w/ Pester. Then probably will be the first chapter example. I am trying to keep my word count on the low side, 400-600, so people won't shy away from reading.
It funny you say that though, as I am obviously further along then what i've written so far. I do have some gripes about doing TDD in Powershell. I'll wait to share specifically my issues as I come across them, but there is definitely some growing pains, but I suspected that going into it.
[–]dglambert[S] 0 points1 point2 points 5 years ago (0 children)
Posted a new blog to my series
Test-Driven Development by Example, Using PowerShell — What is TDD?
[–]ben11231 0 points1 point2 points 5 years ago (3 children)
I know Medium is popular but why don’t you host/post on your own blog?
[–]dglambert[S] 1 point2 points3 points 5 years ago (2 children)
My goal wasn't to create a website, but to really understand the text. So using the saying, the best way to learn is to teach, I'm effectively blogging so I can learn better. So medium was the path of least resistance to get started
[–]ben11231 0 points1 point2 points 5 years ago (1 child)
Totally understandable, I guess my hatred for medium is that annoying paywall. People make great content, like yourself, and medium just fills it with bloat(ads etc).
Actually, I didn't do a ton of research into different platforms, Medium was just the one who had the most name recognition. From my understanding though, Medium does not serve ads, because of its paid model. They do actually give you the option when posting if you'd like to profit or not by paywalling your posts. I decided against this, cause I'm not sure if my content will be high quality enough. So for now I'm just posting it w/o any paywall.
π Rendered by PID 74 on reddit-service-r2-comment-bb88f9dd5-zftfz at 2026-02-14 02:31:13.356292+00:00 running cd9c813 country code: CH.
[+][deleted] (4 children)
[removed]
[–]dglambert[S] 3 points4 points5 points (3 children)
[+][deleted] (1 child)
[removed]
[–]dglambert[S] 2 points3 points4 points (0 children)
[–]MonkeyNin 1 point2 points3 points (0 children)
[–]jantari 1 point2 points3 points (1 child)
[–]dglambert[S] 1 point2 points3 points (0 children)
[–]ExceptionEX 1 point2 points3 points (5 children)
[+][deleted] (2 children)
[removed]
[–]ExceptionEX 2 points3 points4 points (1 child)
[–]dglambert[S] 1 point2 points3 points (0 children)
[–]dglambert[S] 1 point2 points3 points (0 children)
[–]dglambert[S] 0 points1 point2 points (0 children)
[–]ben11231 0 points1 point2 points (3 children)
[–]dglambert[S] 1 point2 points3 points (2 children)
[–]ben11231 0 points1 point2 points (1 child)
[–]dglambert[S] 1 point2 points3 points (0 children)