Automating the everyday

And so my journey into automation continues... Always looking for opportunities to put some automation into practice, I set myself the (somewhat artificial) challenge of writing a helper script that would take a list of URLs and give an interface where you could quickly open any of them in any chosen browser (so more concerned with the automation framework than actual running of tests).

To make it feel like a real project I even wrote myself a brief functional spec:

Read in list of URLs and assign numbers
Command prompt
- n = load next
- p = load previous
- l = show list of URLs with numbers
- number = load URL with that number
- switch browser context (method TBD)

As before I was using Python 3 with Selenium, and the script was surprisingly satisfying to write. I started with the basic step of opening a text file and reading in URLs and built the rest of the functionality outwards from there one step at a time, first opening a browser instance, then getting it to open a given URL, finally wiring that into the choice made by the user and so on.

More functionality suggested itself as I went along, for example at one point I was working at home (due to a snow day!) and had a list of static URL pages that weren't linked by any easy navigation, all of which needed a brief sanity check. I was working off a single screen which made the flicking between the list of URLs and browser window a bit awkward, so instead I wired up a "view all in sequence" option in the helper tool and all I had to do was hit return in a small command window to move on to the next URL. Not a huge time saving but it did mean I could concentrate more on the task at hand.

I think this may be the way my automation experience goes for the time being - most of what I test at the moment is presentation-heavy rather than rich in functionality, and often very transient, so the opportunities for full automation are few and far between. I think the main benefit of automation for me at the moment will be the ability to build tools that will take the strain off some of the more repetitive jobs (e.g. logging-in sequences or navigation through a particular sequence of pages/functionality to get to the point where I'm currently testing). Following this first success I'll definitely be keeping my eyes open for more opportunities to use automated helper scripts, and will share my experiences here as and when they crop up.

Comments