r/PowerShell • • Dec 10 '25

Question How Often Do You Write Pester tests?

Topic, genuinely curious.

20 Upvotes

20 comments sorted by

View all comments

Show parent comment

1

u/BlackV Dec 10 '25

That was a great write up, good to read some reasoning behind the decisions

4

u/PanosGreg Dec 10 '25

Thank you.

One interesting point about Pester is that it makes you write code in a specific way.
What I mean, you need to adhere to the Describe/Context/It blocks and as such everyone's tests need to have that same pattern.

This is not really understood much by people, but it is actually important, because then you get to have a specific pattern (or format if you like) on your code and your team's code.

This is quite rare, another tool that does that is dbt , which enforces you to write the sql code in its specific yaml properties.

And this enforces standardization on the code, which can go a long way.

Note: Pester makes you write according to this "DSL" (Domain Specific Language) , while still allowing you the freedom of writing PowerShell code (as-in code anything essentially), which is very important.
It does not limit you to its DSL, like for example Terraform HCL, or Chef's resources in recipes. Just wanted to point that out.

1

u/psdarwin Dec 10 '25

Good thoughts - it also forces better coding of functions because you have to write them so they can be tested. It's really upped my game for code quality.