Author Posts

May 7, 2018 at 4:03 pm

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

May 7, 2018 at 7:30 pm

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

May 8, 2018 at 10:09 am

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.

May 8, 2018 at 11:51 am

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?