Today, on our internal discussion list, someone asked if there were any advantages to testing with PowerShell versus testing with C#.
I was able to come up with 10 quick reasons to test with PowerShell:
- Being able to run command line programs easier within PowerShell
- Dynamically generating code or test data for a test case (fuzzing or data-driven testing get a lot easier with this)
- Being able to access COM easier within PowerShell
- Being able to embed PowerShell in C# (so you can avoid writing a framework and just embed PowerShell in your infrastructure)
- Being able to use weakly typed variables within PowerShell
- Being able to test APIs on the command line, so you test manually and then automate
- Getting a history of commands, to take what you’ve explored and turn it into a test case
- Being able to strongly cast or coerce types when needed
- Support for verbose, warning, and debug streams to provide additional test information
- Being able to use PowerShell’s systems administration features to help setup or cleanup a test environment
I hope these reasons help convince other software testers to use PowerShell. It can really make testing a lot simpler.
Hope this helps,
James Brundage [MSFT]