You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Jesse Kuhnert <jk...@gmail.com> on 2006/06/05 03:28:31 UTC

state of trunk/new testing

Things are getting pretty close to being ready in trunk, but the form logic
had me stumped for a while (until I discovered this crazy
dojo.validate.check(form,profile) function ) .

There is more testing infrastructure in place on the client side now - all
of it contained in tapestry.test - that handles a couple different things.

-) lastMsgContains(str) - Asserts that the last dojo.log.debug/err/warn/etc
message logged contains the string passed in.

-) mock - Just a simple object, whatever arguments you pass into its
constructor will be checked against the function call that is actually
made...Ie:

var myMock = new mock("This is a string", 12);
dojo.event.connect(someObject, "doFoo", myMock, "intercept");

somObject.doFoo(dojo.byId("field1"));

jum.assertTrue("myfunccalled", myMock.called);

The internel intercept function will do JUM (ie unit test) assertions to
check the arguments passed in equal the arguments you expected, as well as
set an object level variable named "called" that will be true if the method
was called..

It's crazy but now things are finally where they should be, I spend an awful
lot of time writing unit tests in javascript or java and by the time I go to
actually "run" a real application using the features in question everything
works exactly as expected about 95% of the time. Hooray! :)

P.S. If you feel ok with c++ I found this page to be pretty valuable in at
least getting a rough picture as to what is going on in the browser at
runtime (for mozilla at least, and the README is pretty old but...)
http://lxr.mozilla.org/seamonkey/source/js/src/README.html .

-- 
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.