Sunday 23 March 2014

Automated Web Testing with Powershell !!!

I have beeen working in Selenium (see previous posts) building a test suite at my job. I spent quite a bit of time architecting the design and attempting to build bricks with which others could build buildings. I was beginning to instruct the folks on my team (who had not previously written code) on how to use these bricks and understand the mortar. This all in a language (Java) with which I wasn't terribly familiar. The framework design was sound and was beginning to grow on it's own.

Then, the massive changes in the app took place right about the time we were slammed with testing projects that required me to focus on manual testing. By the time the smoke cleared, the testing framework I had written was woefully out of date with the app. Many, many weeks were going to be required to update the component classes and test them all and I was not going to be given the time. Yet, automation was required and expected...right now.

So, what to do??

I have basically started writing tests in Powershell. Why PS? Writing the tests is relatively fast and it is incredibly powerful. I was able to create what I refer to as "QD" tests (Quick and Dirty) that support a happy medium between resusability and speed of development. I've tried to write them with maintainability mind, but not allowed that to override some basic ideas:
    1. Every test should be throwaway
    2. Anything that can't be thrownaway needs to be saved off for resuse
    3. Reusable pieces need to be elegant and very maintainable
    4. It is more important to generate a working test quickly than it is to write elegant code
    5. As quickly as possible, the tests need to be added to our periodic test suite
    

These ideas violate how I would prefer to write tests but in this volatile environment, I cannot invest much time in them. Instead, I write the reusable pieces well and as solid as I can. If the app changes two weeks from now, I am out very little as they can be replaced easily. 

The other benefit is that if I have only 2 hours last week to work on automation, I can probably produce something useful rather than try to ramp up from what I was doing last week. 

Again, this isn't how I'd like to produce tests but it's the best I can do in this situation.

I just hope the testing gods forgive the blasphemy.....


Sudhakar.Mangi

No comments:

Post a Comment