← Back to team overview

launchpad-dev team mailing list archive

Re: Javascript learnings #1: YUI tests

 

> 
> I am a TDD developer. I am not comfortable changing code without having
> a test to verify it. Since Windmill is integration testing, it required
> that I write all the code first, then hope I was testing my script.
> 

+1

When I first started doing some ui work in lp, I only really knew about
Windmill tests. I'm really glad to have started writing more Javascript
tests using the framework/harness Curtis put together. As Aaron said,
they're quick to run, the change-debug cycle time is fast, and they
really are required to properly unit test the ui stuff.

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

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.




Follow ups

References