Please help understand concept of Pester

This topic contains 3 replies, has 3 voices, and was last updated by  GS 2 weeks, 2 days ago.

  • Author
    Posts
  • #100323

    GS
    Participant

    Hello,

    Can somebody explain to me how tests work in situation where changes are required to underlying system to be performed?
    If my functions do not just add some fictional numbers together to be able to detect if they still performed well after the changes to script but instead say modify files or delete files on remote servers, how do I exactly test those functions.
    For example if my script needs to delete files on remote share based on some file pattern. How can I test this sort of scenario by using Pester?

    Thanks,
    Greg

  • #100329

    How are you planing to run these scripts that, for example, delete those files?

  • #100342

    Shane O’Neill
    Participant

    Pester does create a TestDrive PSDrive for you to use that gets created and destroyed with each pester.

    If you need to delete or create files, then this should be a safe place that you can do it without worrying about affecting your systems.

    You can use a combination of using a Mock to call to the remote systems and the TestDrive to checking the creation, modifying, or deleting the files.

    I've linked to the Github documentation so you can check them out and get examples/ideas.

  • #100348

    GS
    Participant

    Thanks,

    Well somebody looks like thought about this situation and created a testdrive object. How about something more generic like modifying IIS settings or script creating scheduled task?

You must be logged in to reply to this topic.