Why I Learn PowerShell

1 minute read

PowerShell is a powerful scripting language where it could easily automate processes like copy a file, unzip a folder, get current date, manipulate text file and lots more. Basically, it could do what a user could do with a computer. It’s cross-platform and runs on Windows, Linux and Mac OS operating systems.

Writing a testing code is the first part towards test automation. The second part is to hook it up into pipelines. This is where PowerShell comes in handy.

Before a test could be run, it always needs an initial state. Certain conditions need to be met before the testing result could be determined. If we could prepare the test data prior the test, the testing process will be smooth and straight-forward.

Look at Scenario 1 for a simple scenario on what PowerShell can do.


Scenario 1: Verify if a customer has pending payment. To simulate this scenario, we need to have an existing customer database. To shorten the testing process and to only focus on validating if a customer has a pending payment, we could have a set of test processes and data ready before the test is run.


We could use PowerShell command to manage the following:

  • deploy the system under test
  • restore a customer database
  • run the tests
  • back up the customer database after running the test
  • generate the test report

PowerShell also helps in managing test after the run completes. It could remove the system or instance and set it back to the initial state.

In PowerShell section of this blog, I will write the code or functions that I always use.