With MS ramming powershell into all new server products, I'm starting to (reluctantly) think I need to take it seriously. Part of "taking it seriously" is TDD. Have you found good methods to unit test power shell scripts?
I've found samples of mocking from Mr Geek Noise - but I'd really like something like RhinoMocks. Brian Hartsock has a sample of running tests on powershell strings from MS Test. A little hacky, but it seems to work.
What I want is a Powershell TDD experience that is as clean as it is in "real" languages.
Update to clarify:
The first two answers attempt to steer me away from testing Powershell. The opinions are interesting. I don't want to know if it's a good idea to test in powershell. That's a subjective question that should be asked in a different forum. I want a solution to unit testing powershell. I you think it's a bad idea (might be), treat it as a fun academic question.
- Yes, scripting languages glue together disparate systems. However, as already pointed out, it's also easy to mock and break seams in a dynamic language.
- I'm not asking about "debugging". Debugging is an extremely useful topic. I'll let someone else ask it.
- Maybe PS scripts should be simple. The language supports modularity and it is inevitable that complex processes will be implemented in PS (even if a bad idea).
- The answer to this question is not "You can't". I can see (from linked blogs - which are a little old) that some people have made headway on the problem.
To re-state: How do you implement an automated testing of Powershell logic in the style of xUnit? Integration tests are interesting, unit tests that break dependencies most interesting.