Jul 14

The team at Jupiter IT have release Syn, a library which allows you to create synthetic events for use in testing. This standalone library is meant to assist in testing complex UI behavior by simulating user actions such as typing, clicking, dragging the mouse.

Testing rich, dynamic web applications sucks. At Jupiter, we’ve tried almost every testing solution available (qUnit, Quick Test Pro, Selenium, JsUnit, Env.js, TestCase) and all of them suffer from some fatal flaw.

Problems:

  • Manual – A tester has to run the tests manually on every supported browser.  People are lazy. 
  • Unit Tests Only – We need to test the app as a whole and complex UI behavior like drag-drop.
  • Low fidelity – We need to make sure the tests are reporting accurate results.
  • Difficult to write – We sling JS like a ninja monkey throws poo.  We want to write tests in a nice JS API.
  • Expensive – A QTP license is 5k a person!  I’d rather buy a vacation.
  • Support – We want to test Mac and Linux browsers.

We’ve solved all of these problems in our upcoming FuncUnit testing framework. It’s a mashup of qUnit, Selenium, Rhino, and Env.js. But its core library, Syn, which does the work of simulating user actions with very high fidelity, is what we are releasing today.

So by using code like this:

JAVASCRIPT:

Syn.click( {},‘hello’ )
   .type( ‘Hello World’ )
   .drag( $(‘#trash’) );
 

you can simulate clicking an element with id=’hello’, typing “Hello World”, and then dragging your mouse from that element to an element with id=’trash’.

Pretty cool stuff. Check out their demo to see how playback occurs.

Continue reading »

Tagged with:
Jun 08
JAVASCRIPT:

var header_test = new Cohorts.Test({
    name: ‘big_vs_small_header’,
    sample: 1, // we want to include all visitors in the test
    cohorts: {
        big: {
            onChosen: function() {
                $(‘#big’).show();
            }
        },
        small: {
            onChosen: function() {
                $(‘#small’).show();
            }
        }
    }
});

$(‘#big’).click(function() {
    header_test.event(‘Clicked on Header’);
});

$(‘#small’).click(function() {
    header_test.event(‘Clicked on Header’);
});
 

The code above shows you exactly how you could run a test that shows either a large, or small clickable header… and gives you A/B results on how many were clicked.

This is all view a new library called Cohorts by James Yu:

Cohorts is a simple, purely javascript, multivariate testing framework.

It allows you to easily run split tests for visitors on your site, showing them different designs, layouts, or whatever you want. Cohorts also allows you to track interesting events that occur for each of the cohorts. By default, it uses Google Analytics event tracking to store data, but you can customize it to use your own or another.

Very nice.

Continue reading »

Tagged with:
Feb 17

Martin Aumont has released Harmony, which “provides a simple DSL to execute JavaScript and DOM code within Ruby.”

This enables you to do very cool things such as unit test JavaScript in the same area as your Ruby tests:

RUBY:

    require ‘test/unit’
    require ‘harmony’

    class JavascriptTest <Test::Unit::TestCase
      def setup
        @page = Harmony::Page.new
        @page.load(‘public/javascripts/foo.js’)
      end

      def test_foo
        assert_equal "world", @page.execute_js(<<-JS)
          foo = new Foo;
          foo.hello();
        JS
      end
    end

and you can even use JavaScript libraries…. as script tags are autofetched:

RUBY:

    require ‘harmony’

    page = Harmony::Page.new(<<-HTML)
      <html>
        <head>
          <script src="javascripts/jquery.js" type="text/javascript"></script>
        </head>
        <body>
          <div id="widget">ohaie</div>
        </body>
     
    HTML

    page.execute_js("$(‘#widget’).innerHTML") #=> "ohaie"

This library builds on the shoulders of giants, one of which is Mr. Johnson, John Barnette who I had the pleasure of working with many moons ago. He is the person I think of when I remember that the best engineers that I have worked with haven’t been computer scientists, but musicians and biologists. He is also a great fun guy.

Anyway, sorry for the aside.

If you are a Rails chap, you may also be interested in the Rails plugin holygrail.

Continue reading »

Tagged with:
Feb 10

AJAX (Asynchronous JavaScript and XML) is an approach to web programming that has been enjoying great popularity ever since it was used by Google for many of its applications, notably Google Suggest and Google Map. There has been a lot of discussion about a number of issues related to AJAX including:

* tools and techniques for implementing AJAX (e.g. Ruby on Rai ls, DWR, Prototype, Sajax,

* Ajax.net) [1,3]

* business case for using AJAX [2]

* usability of web appli cations using AJAX [5]

* optimizing network bandwidth uti lization using AJAX for application development[6]

Considering that one of the key drivers for the rapid adoption of AJAX has been its promise of superior performance, it is surprising that there has not been much discussion of AJAX-specific performance testing. When we studied this in some detai l, we found that AJAX applications indeed present some unique issues and challenges, which we discuss in this paper.

Continue reading »

Tagged with:
preload preload preload