Re: testing rapid

6 views
Skip to first unread message

Bryan Larsen

unread,
Jan 16, 2012, 11:59:58 AM1/16/12
to Tom Locke, Matt Jones, Domizio Demichelis, Owen Dall, Kevin P, haya...@pfsl.mech.tohoku.ac.jp, Compton, Jack, Venka Ashtakala, hob...@googlegroups.com
(Moving to hobo-dev for wider discussion).

On Mon, Jan 16, 2012 at 11:26 AM, Tom Locke <t...@tomlocke.com> wrote:
> Moving to a 'validate the generated HTML' type structure will remove
> the browser requirements. So it's a "which is worse: JRuby or
> firefox, chrome & webkit?"
>
> What about testing the javascript? Don't we lose that if we move away from
> Selenium?
>
> Tom

Javascript will be tested via QUnit or some other javascript testing
framework -- I don't have much in QUnit yet, so I'm open to
suggestions.

The idea is that we have two well-defined interfaces: from Hobo to
hobo-jquery/etc (aka data-rapid) and from hobo-jquery/etc to Hobo (aka
ajax_update_response)

The tests then get broken into 3 pieces that test to these interfaces:
rapid DRYML, hobo-jquery javascript & ajax_update_response.

The first piece is a test of DRYML generation similar to what Matt is
currently doing, hopefully robustified via my XMLUnit code. It would
verify that the form tag generates appropriate HTML appropriately
marked up to our new javascript interface standard.

The QUnit tests would take as input a plain HTML file containing form
tags with data-rapid annotations and test the javascript
functionality. It would mock/stub the ajax_update_response interface
for testing Ajax.

The last piece that theoretically needs testing would be the
ajax_update_response function. Right now, I think we just test it
via smoke test -- it's small enough that if it's broken, presumably
that shows up right away.

Before we nail this down too far we should probably review the
proposed interfaces. The first is the `data-rapid`,
`data-rapid-context` and `data-rapid-page-data` annotations described
here: https://github.com/bryanlarsen/hobo-jquery/blob/no-prototype/README.markdown.
I went through enough iterations on that one that I'm fairly happy
with it.

The other is the interface implicitly defined by ajax_update_response
in https://github.com/tablatom/hobo/blob/jquery/hobo/lib/hobo/controller.rb

An example usage of that interface can be seen in buildRequest in
https://github.com/bryanlarsen/hobo-jquery/blob/no-prototype/public/javascripts/hobo-jquery/hjq.js
(see the render and render_options query attributes).

Which shows that the interface has evolved rather than been designed,
and isn't documented. So it definitely needs to be reviewed &
documented.

thanks,
Bryan

Reply all
Reply to author
Forward
0 new messages