← Back to team overview

launchpad-dev team mailing list archive

Re: Javascript learnings #1: YUI tests

 

> 
>> 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.
>

Yes. I hadn't gotten to that yet but have just now updated the 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.
> 

Yes, simulating mouse clicks. Think of it as black box testing. Often
the callbacks are not exposed and accessible to the test harness and you
want to see that all the internal wiring of handlers and callbacks is
correct and the DOM is properly updated (the output) in response to a
user action (the input), albeit short circuiting that aspect of the
interaction that occurs outside the component under test.

>> 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.
> 

True, but my hope is that given the *much* lighter nature of the
pages/javascript being loaded for the yui tests vs the full Launchpad
client, that Windmill will behave itself. I think it's worth doing as a
first step and we can re-evaluate if there are issues.




Follow ups

References