← Back to team overview

launchpad-dev team mailing list archive

Javascript learnings #1: YUI tests

 

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

Like many of you, I hadn't done much JavaScript work since the original
Launchpad Epic until recently.

However, I recently worked on the SourcePackage +sharing-details
AJAXification, and I learned a lot doing so.  I thought I should share
what I've learned, so that others can benefit.  And if people correct
me, I'll benefit too.

The first thing I'll mention is YUI tests.  If you're a TDD developer
(and if not, why not?), YUI unit tests are the way TDD should be.  The
change/test cycle is very fast (to run the tests, hit "reload" in your
browser).  And since they're proper unit tests, they feel like a safety
net when you start to make changes.

They are a good way to test your model code and HTML changes.  They
aren't a good way to test actual AJAX (i.e. client-server I/O).  TDD
with YUI tests will encourage you to make most of your code I/O-independent.

You can use a mock for AJAX calls, but for actual AJAX testing, use
Windmill (or whatever we replace it with).

For information on how to get started with them, see:
https://dev.launchpad.net/JavascriptUnitTesting

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

iEYEARECAAYFAk2keTgACgkQ0F+nu1YWqI2qaQCffrYdwi3hff076/oQRRmaJT1w
N2sAnRIavtnp4Z3SjcGU+K4HUsKtsZWq
=Gz7C
-----END PGP SIGNATURE-----



Follow ups