PowerShell Unit and Infrastructure Testing
summary
Shows concrete, runnable work: Pester 4→5 breaks scoping and forces fixes; demos mock of Invoke‑RestMethod to fake an external IP and verify get‑IP logic; explains beforeEach vs beforeAll scope bugs and why tests must be atomic; uses VS Code Pester Test extension for watch, debug and detailed output; runs real tests against a 2,165‑line module (modulefast), finds a flaky AZ dependency count and trims runtime to ~2.5s. Tests pass or fail with exact expected vs actual output so regressions are visible.
AI-written summary · about
chapters (8)
- 0:00PowerShell testing with Pester
- 2:14Why testing matters
- 10:13Pester basics and DSL
- 1:01:34Running basic Pester tests
- 1:31:50Mocking dependencies
- 2:11:50VS Code extension for testing
- 2:43:48Advanced Pester features
- 3:01:30Q&A
related talks
36mBeyond Pester 101: Applying testing principles to PowerShell
39mWriting Pester Tests at Scale
48mHow to Love Unit Testing
41mPesterize Your Code!!
37mTesting, Testing, 1...2...3: Using Pester for Infrastructure ...
43mBeyond Pester 102: Acceptance testing with PowerShell
43mBeyond Pester 103: Applying a Testing Mindset
35mIaC Automated Assurance
