← Back to team overview

launchpad-dev team mailing list archive

Re: Javascript learnings #1: YUI tests

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11-04-13 09:44 AM, Ian Booth wrote:
> Also, it is really easy to mock the xhr round trip so that you can test
> how the ui responds to server side calls without having to resort to
> Windmill.

I didn't want to do any mocking, so I kept the code that relied on XHR
roundtrips isolated from the rest.  I think that led to good factoring.

> One example of how I did this for a recent test I wrote can be
> seen in lp/app/javascript/tests/test_multicheckboxwidget.js where I
> implement a patch request stub. You can also use Y.Mock for other
> similar scenarios.

Showing how to mock XHR might be a useful addition to the testing page.

> You really only need Windmill when you want to check
> that data sent from the client is correctly stored/processed on the
> server side, not simply to check that the ui updates after a user
> initiated action.

By "user-initiated action", do you you mean simulating mouse clicks?  I
would have though you'd be testing callbacks rather than the actual UI.

> Note: javascript tests are run by a harness in the Windmill layer. Since
> Windmill tests have been turned off again due to reliability issues, I'm
> thinking we should pull out the javascript tests into their own layer so
> they can be run independently of the Windmill ones and hence left turned
> on even when/if the Windmill ones are not.

+1.  That would also let us to run all the YUI tests interactively,
which would be nice.

But I think it was *Windmill* that failed, not its tests.  So using
Windmill to run just the YUI tests could also be problematic.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2lslIACgkQ0F+nu1YWqI0a8gCfa/j3JDjbJyYqbQlKxK9HS25t
9AQAni4+5NN0dH7K52i3OVqWtoFrw2MN
=xUXi
-----END PGP SIGNATURE-----



Follow ups

References