I'm finding v5 incredibly confusing and frustrating...am I missing something basic? #2827
|
I've got a handful of inherited v3 tests, a smattering in v4 I've written, but I'm finding v5 just incredibly confusing/frustrating to get started. This is the 2nd or 3rd time I've tried to get some tests going in v5, and just to be able to pass parameters to invoke-pester I first have to create a "container" object? To change invocation options I have to create and modify a configuration object, and then I can't mix that with other commandline switches - do I have that right? Just to run a basic "hello world" dead-simple test (without reverting to the deprecated v4 parameters) I have to execute N setup commands/ write a wrapper script? |
Replies: 3 comments 1 reply
|
Thanks for trying out Pester. Running Pester tests can be as simple as If you need more advanced features you quickly need a configuration object. There's been a few major changes and lots of new features since v3. Parameters on a single command didn't really scale. If you haven't already, please check out our quick start guide.
Yes. Providing external data through parameters requires creating a container. See https://pester.dev/docs/usage/data-driven-tests#providing-external-data-to-tests If possible, consider using a |
|
If you have some suggestions how to make it less complicated to get started please propose them. Bare Invoke-Pester works, and anything more advanced is done via the configuration object, which itself is browsable and IMHO beats providing hashtables without schema, or or gazillion of parameters like But let's discuss. 🙂 |
|
Thanks everyone for responding - and yes, I had every every link you shared already open in at least one tab. :P I'm sure the functionality is there, I think there's a gulf in between the "getting started" examples and the rest of the documentation for onboarding people. I suspect it's also just designed in a way that makes sense for a certain type of very smart folks, but it doesn't match any of my current mental models. Perhaps also there are examples I have not yet found. (I have found the "Teach yourself Pester" video and repo) I'm sure the fact I'm using it for env tests over remote PS as ersatz Configuration Management doesn't help. :) FWIW I do have it working now in a simple form, for the moment I'm bypassing the parameter issue by setting a global variable and having the param default to that. Gotcha's so far: (I will probably update this as I progress)
(Heck, under "Discovery and Run" it says |
We appreciate the feedback. I've long wanted to add a follow-along tutorial for testing a reference module from start to finish. One day 🤞
The output stream is captured so any objects don't break the test report. You can still access it through the result object by using
-PassThruor enablingRun.PassThrusetting in PesterConfiguration. Example: