Phlip | 27 Nov 2008 05:59
Picon
Gravatar

[TFUI] Re: [agile-testing] Agile Testing Tools

jfalek wrote:

> All projects use Ajax and
> JavaScript (based on the prototype framework).

To unit test Ajax, you must generally test that your business model has injected
the correct data into the correct entry points in your Ajax library. Don't unit
test the wire protocol itself, or the JavaScript behavior in a browser. Rely on
thru-the-GUI tests to keep that end stable.

To detect business values, I let the HTML layer generate its output, with its
embedded JavaScript. I parse the HTML, as XHTML, with XPath, and tweezer out the
<script> tags. Then I drop their contents into a JavaScript lexer that turns its
variables into a data model. Querying this model should return the correct data
values.

That kind of test intercepts the values at the last moment before the GUI layer
takes them over. And (under Ruby on Rails) the test start by mocking the server,
so we have no excess programs anywhere. No web server, internet wire, web
browser, DOM, or JavaScript come between our unit tests and the tested code.

--
Phlip

__._,_.___
Recent Activity
    Visit Your Group
    Give Back

    Yahoo! for Good

    Get inspired

    by a good cause.

    Y! Toolbar

    Get it Free!

    easy 1-click access

    to your groups.

    Yahoo! Groups

    Start a group

    in 3 easy steps.

    Connect with others.

    .

    __,_._,___

    Gmane