How to Love Unit Testing
summary
Argues that unit tests using Pester and PoweShell mocking actually speed development by isolating dependencies; shows integration tests that take 9–22 seconds each versus near-instant unit tests, demonstrates mocking with Mock and Assert-VerifiableMock and use of New-MockObject, and explains handling strongly typed params. Builds an oops module that exports command/parameter JSON and asserts metadata to catch breaking changes; demos sometimes fail (missing Compress-Archive, VS Code terminal issues) but the JSON-audit approach works.
AI-written summary · about
chapters (16)
- 0:00Intro
- 2:30Common Questions
- 3:37Today's Goals
- 4:20Why Love Test Suites?
- 8:31What is Unit Testing?
- 16:142 Unit Tests, 0 Integration Tests
- 16:31Integration Tests. We're still Friends!
- 21:00Unit Test "Drawback" #1: Testable Code
- 21:16Parameter Types
- 23:57"Tryhard" Mode
- 33:24Limitations of Parameter Filter Mocks
- 34:52Consistency Tests
- 35:33Negative Tests
- 44:08How Can You Love Unit Tests?
- 47:07PowerShell Summit Resources
- 48:03THANK YOU!
related talks
03h 02mPowerShell Unit and Infrastructure Testing
39mWriting Pester Tests at Scale
56mIf You Won't Test Your Code, Who Will?
52mxUnit Expanded – Better Testing With xUnit
29m"Testing. Why so serious?"
42mUse testing to Develop Better Software Faster
01h 05mMicrotesting
43mBeyond Pester 102: Acceptance testing with PowerShell
