The IDE's of Selenium


I've been trying to figure out what my first real post would be and there are many subjects I will end up posting about however I thought I'd start out with perhaps what can be considered a curious admission. I love Firefox's Selenium IDE. This beautiful yet flawed Record and Play tool has saved me countless hours of manual and exceedingly repetitious testing. It's wonky and stubborn and yet has moments of beautiful autonomy. You just need to know how to talk to it. You be nice to it and it will be... err..moderately nice to you.

I was aware of this tool for awhile before I initially played around with it. I would record a task and replay it but it seemed too fragile and the tests I created where not highly reusable due to the nature of how I was using it. Even though I could replay the test it still needed a lot of manual intervention. I had a hard time reconciling putting so much manual effort into something purporting to being an automation solution. After a couple of days I cast it from my mental toolbox thinking it wasn't worth my time.

About a year later I was working with a developer to test some code he was working on. In our test environment he needed one of our texting devices to continually send SMS messages to a phone number. Not only that but the message had to be unique every time to ensure the proper messages were being sent and in order. My initial thought was to do it manually and just kiss an hour goodbye. Then he said we may need to repeat this test several times. Losing hours of my time for this wasn't possible. We had an existing back-end tool that could simulate sending messages but nothing about it was automated. It was then I decided to resurrect the IDE to see if it was up to the challenge.  I broke the task down into simple sections and did research if the IDE could handle it.

First, could the IDE cycle through an action to repeatedly do something?
Answer: Yes, using a combination of DoWhile fanciness coupled with a GoTo command I could repeatedly send a message from the back-end message simulator by setting a predetermined number of cycles.

Second, could the IDE create a unique variable every time it cycled through?
Answer: Yes, through some simple JavaScript wizardry (copied from the internet) I was able to capture the current date and time and stuff it into a variable. Then every time the test cycled though it would continually create a new variable with a new timestamp.

I was also able to do the same thing and append a chronologically incrementing number at the end of each timestamped message.

Here is the final test and the output:


Since that enlightening day I tried to see what other daily tasks I could automate. It turns out, quite a lot. I was able to automate nearly all the functionality on our website. That first test grew into 50+ tests with JavaScript random guids and DoWhiles. We already had robust nightly automated tests built on C# code running every night so my tests were not to replace those. My IDE tests allowed me to create test users and check customer billing processes and so much more. And all this could happen as I was doing other tasks. Once the tests where made all I had to do was keep an eye on them while I did other work. And since I was watching them as they ran I could pick up certain failures that slipped through the main automated tests.

As much as I love the IDE you really do need to babysit it. You can mask some issues with explicit waits (their called “pauses” in the IDE) but there are occasional times when a test will bomb out for seemingly no good reason and not much to go on in the logs. Pauses sometime just fail for no reason accept for a generic [error] There was an unexpected Alert! [Error: error]. But you start the test where it failed and it continues to work fine. If you can get used to the idiosyncrasies and tame the hiccups it can be a powerful multitasking tool for regression or any highly repetitive tasks.

And if I take off my rose colored testing glasses I know all this may will come crashing down one day. As it stand now the IDE isn't even supported anymore in the most recent versions of Firefox. It is only supported in Firefox ESR 53.5.3 so it will one day fail to load and I will need to figure out what is next. And yes, there are other Record and Play tools out there but as they say, you always remember your first.

Comments