Interesting Things

  • Webrat, the acceptance testing framework that is all the rage right now, has a neat lesser-known save_and_open_page command that is helpful for debugging when your tests go wrong. Essentially, this command dumps the current HTML to the browser and lets you inspect the state of the page visually at any point within your test.

  • Rubymine, Pivotal's favorite Ruby IDE, doesn't really support UTF8. You can type UTF8 characters seemingly fine ... but somewhere along the way it doesn't save properly. Apparently this has been an issue with Rubymine for quite some time. Frustrating.

Ask for Help

  • Anyone know a reliable way of CSS regression testing? When we are refactoring CSS or markup, it would be great if there was an automated way to detect visual breakages. Some ideas floating around involve taking screenshots through Webkit's API and comparing them pixel by pixel. This kind of thing has been attempted twice by Pivots without much success. Anybody have a good solution?

Comments

  1. Visnu Visnu on April 21, 2009 at 05:18PM

    You know, a javascript check after the page is rendered might help and give more informative breakage information. A traversal of all Dom nodes and getStyle (prototype) comparison with previous values. Wouldn't catch everything like display:none but could catch some things much more meaningfully than comparing screenshots.

  2. Chris Eppstein Chris Eppstein on April 21, 2009 at 08:12PM

    One idea to address Visual Breakage is to use humans in the form of Mechanical Turk. Take two screen shots of all your major pages before and after, and pay someone a few cents to compare them and say if they're the same or not. If the human eye can't detect the difference, it probably doesn't matter.

    I don't think a good automated approach exists and I don't know if one ever will before sentient AI ;-)

    Also, if you're refactoring Sass stylesheets, I would encourage you to write a basic unit test for the compilation of them. Compass comes with a base test case for this purpose: http://github.com/chriseppstein/compass/blob/master/lib/compass/test_case.rb. At caring.com we use it like so: http://gist.github.com/99356

  3. Wes Maldonado Wes Maldonado on April 21, 2009 at 08:18PM

    Try adding "-Dfile.encoding=UTF-8" to your JVM startup options, might help.

  4. Wolfram Arnold Wolfram Arnold on June 20, 2009 at 12:24AM

    RubyMine on Linux (Ubuntu 8.10, 64bit) does seem to record UTF-8 characters correctly.

    Running on Sun JVM 1.6

  5. Michael Nutt Michael Nutt on November 09, 2009 at 04:04PM

    I was working on a css regression tester that did pixel-based comparisons a while back. It prompted for each visual difference and used an ImageMagick feature that flashed between the original and new version, making it easy to see which pixels had changed.