Excellent screencast for "Selenium on Rails"

Posted by rick Mon, 20 Feb 2006 20:46:00 GMT

Check this out. Jonas Bengtsson has released a new screencast showing how to integrate Ruby and Selenium for browser-based acceptance testing. Bonuses include use of the Selenium IDE, Ruby test authoring, and automation of both IE and Firefox (on Windows, granted, but it’ll be cross-platform shortly, I have a feeling).

Very cool.

Posted in ,  | Tags , , , , , ,

Building IE on Linux

Posted by rick Sat, 18 Feb 2006 18:46:00 GMT

There’s been some interest from people who want to set up “IE on Linux” as we mentioned we were doing to help with automating IE testing. As you’ll see, the process is merely a testament to the hard work done by others to make this not only possible but easy.

First off, make sure you’ve got licenses for the software you’re installing. I’m not pretending to be a lawyer, not pretending to interpret the Microsoft EULAs that might apply. I think it’s safe to say you’d better have licenses on hand.

I’ll be assuming you don’t already have Wine installed and that you don’t already have a ~/.wine directory already. If you do you’ll need to take that into account. I’m installing on Debian (unstable), but I’ll be installing from tarballs, so as long as you’ve got the dependencies needed to compile wine you should be ok.

Ok, it’s just this simple:

  • download the 0.9.7 Wine tarball here
  • tar xvj wine-0.9.7.tar.bz2
  • cd wine-0.9.7
  • ./tools/wineinstall
  • cd ..
  • tar xvfz winetools-0.9jo-III.tar.gz
  • cd winetools-0.9jo-III
  • su
  • ./install
  • exit
  • cd ..
  • wt
    • do Base Config
    • create a Fake Windows Drive
    • Install TrueTypeFont Arial
    • Install DCOM 98
    • Install Microsoft Foundation Classes 4.x
    • Install Internet Explorer SP1 English

Now, if like us you are behind a proxying firewall, you’ll have a headache when trying to install IE since the installer doesn’t typically see your proxy. To install from behind the proxy you’ll need to do the following:

  • Wait for the download to eventually time out and fail.
  • Click “Advanced”
  • Click the proxy checkbox, then fill in our proxy IP and port.
    • (For some reason I had problems typing in the proxy info boxes and had to use cut-and-paste to get the info in there(?!).

When you’re done, exit out of Winetools. Now you’ve got a .wine/ directory with a “C drive” with IE6 installed. I’d advise backing up .wine/ so you can recreate this configuration with a one-liner (now, don’t you wish that working with Windows was always this easy? Heh.)

To run IE now, simply run IE:

% wine ”$HOME/.wine/c/Program Files/Internet Explorer/IEXPLORE.EXE”

You can append arguments for IE to the end of the command-line.

I’ve verified that Javascript does indeed work, but PNG support is still missing. I haven’t had a chance to try the things mentioned in this forum yet to see if I can get PNGs working. Any feedback on that issue is welcome.

Posted in  | Tags ,

IE on Linux

Posted by rick Tue, 14 Feb 2006 22:22:00 GMT

Taking the advice of Peter Merel from the last post, we're beginning to pursue the automation of browser-based testing for the project. Automation to me means Linux (no way in hell I'm going to try this on Windows, that's just a rabbit hole), so I set up Microsoft Internet Explorer 6 on Linux this afternoon. I'm not sure if this is sacrilege or making the best of a bad lot.

Either way, here's proof:

Posted in  | Tags ,

Help testing helpers

Posted by rick Wed, 08 Feb 2006 21:31:00 GMT

Ruby on Rails is big on testing. There’s support for unit testing cooked right in—every time you create a model you get the unit testing framework built for free—just fill in the blanks. Similarly, whenever you create a new controller, you get the functional testing framework built for free—just fill in the blanks. Seems like view testing (with Selenium and OpenQA) is moving forward, and I wonder if some sort of automated support for those won’t come from the Rails framework itself soon…

That said, there’s very little talk about testing helpers—those bits of Ruby code that are made available for use by the view, but which aren’t in the templates themselves. Helpers aid reuse, and are a valuable use of Ruby behind the template.

Certain helpers can be tested with test/unit, just like unit tests for models. Some helpers, though, call functionality in the view libraries: a really common idiom is to provide various foo_link() methods that will generate links to certain types of objects. Rather than repeating the same detailed ActionView link_to() call everywhere, the code is factored out to a helper method which assembles the appropriate information and calls link_to() for you. Then you’ve got a single point of change whenever you want to change how comment links, story links, user links, whatever, behave.

Testing this sort of code should require a functional test, since you’ll actually want to have the view instantiated. There’s seemingly zero documentation on how to do this, and, checking around on some existing Ruby projects, I see people writing these sorts of helpers, but I see noone actually testing them.

We’ve jumped back for a moment and are relying on “stub” code to allow us to get a primitive, but less than ideal, test of our link helper (and other similar helpers that call ActionView functionality). We’re now looking for guidance from the Rails community.

To that end, we’ve posted Rails ticket #3775.

Posted in ,  | Tags , , , , , ,

Selenium for Rails, finally?

Posted by rick Mon, 06 Feb 2006 15:11:00 GMT

Jon Tirsen pointed out that there’s what appears to be a full-featured Selenium on Rails plugin now available. We’ve been eyeing Selenium to help us with automating browser tests and acceptance tests, but have been sort of waiting for the dust to settle to see which approach at Rails integration is going to be the best. This plugin wasn’t even on our radar, but it looks really promising.

UPDATE: Speaking of not on our radar—there’s also a new Selenium IDE that’s a Firefox extension for (among other things) writing Selenium tests. Crazy.

Posted in ,  | Tags , , ,