Diving back into Selenium and saving me some time

Brian LeGros | September 24th, 2008 | programming  

Over the years I’ve been using Selenium as my tool of choice for UI testing on the web. Recently, we’ve had the need to regression test a vendor web application due to some poor quality builds being produced. Based on past experience, it takes us about 40 hours of work to regression test the product UI by hand, including double checking for annoying copy changes that always seem to slip through. Today we finished the first chunk of a baseline set of tests that accounts for roughly 30% of our test plans. It took us about 150% of the time needed to do one regression test to get this first chunk done. Since we regression test regularly, we’re going to incrementally add more tests each time, getting into a habit of updating our Selenium test suites with the latest changes per build. With that said, let me just tell you this is probably one of the most detailed applications I’ve had to test with Selenium. Guess how long it takes to run our tests that don’t require some type of manual setup … less than 5 minutes. So we’ve taken a third of our tests that took about 10 hours to execute and reduced them to 5 minutes of watching the browser go nuts with all the typing and clicking. There is still work to be done manually that we will never escape (global system setup), but talk about saving time. No matter how much I use Selenium I never get tired of the benefit it provides in the long run.

So all though these stats are encouraging for management to hear, but what I really like about Selenium is how simple it is to create test suites. Don’t get me wrong though, there a few things that can cause hang-ups. Hacking out XPath statements is one that I face quite frequently. Consider a command in Selenium called verifySelectLabel which takes a locator (typically an XPath expression) to find the select box in the DOM and a pattern (typically a simplified regex) to match the text of the option currently selected in the select box. The Selenium IDE has a “Find…” button to help validate the XPath statement and some context menu options in the browser to help, but in most cases I always find myself messing around with the XPath statements. Recently, while playing around with Firebug (my favorite JavaScript swiss army knife) I noticed that under the HTML tab when right-clicking on a tag you get the option Copy XPath. Selenium’s XPath support is really robust and the Firebug’s syntax ports over flawlessly. I did notice that while running in IE I had to simplify the statements sometimes to get them to pass, but otherwise, it’s cut my recording time down considerably.

Another thing that always sucks up my time is when I have to hack together JavaScript to get data ready for a test (especially when it comes to dates). The storeEval command will execute a JavaScript snippet and take the result of the last line and put it into JS variable for later use. In the past I’d fire up a kind-of scribble pad HTML doc with some inline script and test my code, but this time around Firebug is all I needed. The Console tab gave me my own scribble pad with the added help of the Firebug console object. Another cool JavaScript helper I hadn’t used before was the user-extensions.js file, which is imported into the test runner giving you access to whatever JS you want to re-use. I found a pretty descent date API that I copy/pasted into this file making working with dates in my tests stupid simple. Finally, this is the first time I’ve tested a product that I didn’t help write and that was written using ASP.NET Web Forms. With the help of debug(), monitor(), and the Inspect tool in Firebug, I was able to find my way around the mess of scripts on the page very quickly. Even though the generated code wasn’t my favorite, I have to give credit to ASP.NET’s management of inputs; each input was generate with a unique ID which made testing incredibly easy.

Overall, it was great to get back into using Selenium and I’m really excited at the possibilities of starting to use Selenium Remote Control and Grid. The prospect of getting my unit testing framework (NUnit) into the picture will definitely help to complete and simplify the build process. What’s even cooler is that once we’ve put all the work into recording our tests in HTML, the Selenium IDE will translate them into C# so we don’t have to repeat ourselves. With new extensions for working with Flex, this tool’s potential continues to grow. If you’ve never tried out Selenium, definitely give it a shot. The barrier to entry is low and you can choose the level of complexity you want to bring to the table.

RAnDOM is ready

Brian LeGros | August 4th, 2008 | news  

After weeks of planning and months of picking a name, a few of us have finally put together a user group for the Brevard area. The group is called RAnDOM, Rich ApplicatioN Developers Of Melbourne. Our blog is located @ http://itsrandom.info. If you’re interested, you can see the cool layout that Sebastian put together for us.

My hope is that by bringing this group to Brevard we can begin to really grow the developer community in the area. We have an active .NET user group and Florida Creatives is getting started, but as far as coding goes, there aren’t that many opportunities to learn in a hands on way. At the Adogo, I really enjoyed our code camps these past few months, so I think that since we’re likely to start small, we can establish a great group by just hacking away. The area also seems to have a lot of web consulting companies, so maybe we can even a few of them to come out.

I really want a place to get together with fellow developers to code and discuss whatever may come over a cool beer and some wifi. If this is what does it, right on; if not, at least I still got a cold beer.

:)

Brevard user group meeting time

Brian LeGros | July 26th, 2008 | programming  

Well, this week I’ve gotten one step close to organizing a Brevard RIA/web developer user group. I hope to have our first meeting on August 21, 2008. I’d like to have the meetings every 3rd Thursday of the month starting @ 8:00 PM, lasting for about 1 to 2 hours based on the topic. Short of finding a place beachside or near 95 that is open in the evenings and has wifi, we’re going to stick with House of Joe for now on 192, next to the Melbourne Mall. Initially it looks like it’ll be a small group of us, so I’m not too worried about space being available. The new Florida Creatives group for Brevard looks like they are going to meeting on the 3rd Tuesday of the month, so that may cause some conflicts initially, but since I have little visibility for the group as of yet, we’ll see how it goes.

Now we need to just work on a name/acronym so I can get a domain and blog up. Here are some of the suggestions we have thus far:

  • Brevard Area Developer of Rich Internet Applications (BADORIA)
  • Brevard Network of Developers and Enthusiasts (BNODE)
  • Brevard Developer Web Group (BDWG)
  • Brevard Area Rich Internet Application UG (BARIA)
  • Brevard Rich Internet Application UG (BRIA)
  • Brevard Rich Internet Application Developers (BRIAD)
  • Rich Internet Application Techies (RIAT)
  • Web Brevard User Group (WEBBUG)
  • Brevard Area Web Developers (BAWD)
  • Beachside Developers (BSDEV)
  • Rich Internet Application Brevard User Group (RIABUG)

I’d like to have Brevard and something like Web or RIA in the name, but I’m still undecided. Does anyone has any suggestions? I’m open to ideas.