Monday, October 02, 2006

Pausing a PowerShell Script

I was having an issue while running my watir scripts where if I ran a script that saved information to the database on two or more machines at the exact same time, failure was sure to follow. This is really annoying and not likely to happen in the real world. However, in the alternate universe where I do my testing, this happens all the time. Alternate universes are cool.

We now have a lot of Watir scripts, and it is really tedious to run them individually. So I wrote a script that calls each one sequentially using PowerShell . With my new batch script, I am able to kick off all the Watir scripts from all of my test boxes at the same time and walk away while the website gets put through its paces. This works great until New York and DC try to save changes to the same story at the same time. One of the watir scripts will fail. Usually New York wins. Stupid New York.

I'm sure that there is a great solution, which involves messing with the database, but I don't have that kind of time, or patience or attention span. For the time being, I just wanted to put a pause in the execution of my PowerShell script that waited for me to press enter to continue. So here you go:

Code of Power:



No comments: