-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: TestDrive for Registry #402
Comments
I think one could implement that with transactions since they don't write to the registry directly until you commit the changes with |
That should be quite easy to implement, the test drive is just folder in Temp that has uniquely generated name. This folder is then mapped to the TestDrive PS Provider. You can do the same with registry. The only thing that would be a bit clumsy is that the Pester is not very modular at its core, so you need to setup and tear down the registry folder for each describe. |
I am starting to use Pester on PowerShell modules that do a lot of writing and reading to the registry. A testdrive for the registry would be great and would simplify the tests. |
I am in the same boat with you all, doing some registry work and starting to use Pester for testing it. It would be nice to spin up a new test drive pointed to a hive file object in the $env:Temp path as well, something like TempReg: or HKTR:. Might just look at what it takes to spin up a registry hive in the Describe block, and tear it down afterwards. |
I also came across the need for this functionality. +1 |
I second the request. Also for an ActiveDirectory test drive +1 |
@fschumann1211 AD test drive is not going to happen, we would have to take dependency on the AD cmdlets, and install a real domain per-test :)) The registry test drive I'd like to implement, but unfortunately I have so little free time :/ |
I'm also looking for a way to test registry reads and writes. I could start to implement something similar to TestDrive, but see an issue with cross platform compatibility. Linux doesn't have something comparable. See: Pester/Functions/Environment.ps1 Lines 32 to 42 in 517f40c
I pushed my current changes to this branch and am looking forward to your (@nohwnd) feedback about the OS compatibility. |
@andikrueger looks good, I quickly read through it and don't see any obvious problems. Please make a PR from that branch. :) I'd like to test the clean-up a bit more, and see what is the impact on performance. |
One thing that I have been doing frequently in my scripts is writing to the registry. I've been using mocking to unit test anything that I write to the registry and it has worked well, but after using TestDrive in some of my scripts for writing and deleting files I keep wishing that I could do the same thing with the registry.
I was wondering if anyone else would be interested in seeing a feature like TestDrive for the Registry, and if its possible, could we see that as an added feature some time in the future.
The text was updated successfully, but these errors were encountered: