ART or How I Learned to Stop Worrying and Love Automation
When I interviewed for my position as QA Analyst I was asked if I could code an automated testing suite. The answer was no, but I wanted the job so I said I could learn. For the first few months after I was hired, automation was something that was lurking in the back of my mind as this daunting, promethean task that I had to figure out how to do. My only career experience was as an end-user tester; I was a psychology major; I had literally failed high-school algebra. I had also said I could do this.
I started at the beginning, reading up on automation at work and when I could carve out spare time. I did the Ruby course on codecademy. I looked into Selenium IDE and Firebug (too brittle, too specific). I looked into Helium (They do Java and Python, but not Ruby). I thought about outsourcing to Sauce Labs (I have to write all the scripts anyway AND we have to pay? Lame). At this point in the game, I’d been researching for months and was no closer to figuring out the best way to do this.
One day, my boss signed me up for a webinar that sent me down the rabbit hole that eventually led to the solution. I now realize the speaker for the webinar was Dave Haeffner, but I had no idea who he was at the time. Basically, I ended up at this repo from the webinar. From there, I eventually ran into one of Dave Haeffner’s repos on git hub and then my brain figuratively exploded.
This was exactly the concept I had been searching for. I wanted something local, that we could control, that we wouldn’t have to pay for, and wouldn’t break every time the UI changed slightly. I used our internal resources to make myself a dev environment and started trying things. Initially I put my testing folder right smack dab in the middle of our app (“Do NOT put that on git hub.”- Jeremy, Wellbe developer). I installed every existing gem in our app. I just copy and pasted random crap everywhere. Eventually (and I’m not really sure how) I actually started getting things semi-right. Right enough that I could formulate a question to get further along, but unfortunately I couldn’t find the info anywhere. Googling “Selenium + Ruby” got me virtually nowhere except another Dave Haeffner’s sites. So at this point, I finally wise-up and realize that this guy is probably the guy who can help me so I email him asking about Selenium and Ruby.
His response leads to another break in the metaphorical case: Capybara. And a demo of how to actually set up what I was looking to do. Now is around the time I actually got going. Setting up a project wasn’t exactly easy. Jeremy deleted half of what I did and had to keep reminding me of pretty simple stuff. It took two months of me beating my head against a wall to figure out how to get it to run on more than one browser. But I eventually got to the point where it was possible to write a test.
So, hey, I figured out the Ruby part, WHOO! But then you have to actually write the test. I had decided to use Capybara, thanks to Dave’s excellent suggestion, but I didn’t really understand it. Luckily with Cucumber, the hard part gets done for you. After that it’s just a matter of plugging in classes, IDs, and occasional variables until you have a feature written. Easy, right?
I finally got my feature test running locally a couple months after I got the project set up. It was about 4:30 on a Friday and the only thing that got it working was a magical puts statement that does nothing but get the cursor into a date-time picker. This was, of course, after trying to search for the xpath, having one of the devs rename it for me because I thought it wasn’t finding the ember id, but nothing worked. Except for a random puts statement.
ART (Automated Regression Testing) was officially born. I screamed. Loudly. And took a victory lap around the office while screaming. Then I went on a two week vacation to Belize smug and self-satisfied.
When I came back we got the whole thing on github and then hired a guy who doesn’t use anything I set up and does it in like 1/16th of the time. But hey, I did it.