I am already familiar with the start() stop() abilities of qunit, so
this isn't about that.

My question I guess is more of process.

If I develop an interactive feature that involves ajax submitting a
form, and then updating the interface when the json comes back
successful, how should I design my unit tests?

For instance, say that I want to check that the json that came back
from the server side contained data.success = true. If I initiate the
form submission from a free standing unit test, I wouldn't know how to
hook into the data that happens from an ajax call as a result of the
form submission. Similarly, I wouldn't really have an elegant way to
wait for the server response and confirm that my interface was updated
correctly... other than some sort of timeout.

So in this type of situation, do you actually build your tests right
into your code and have them only fire if certain "testing mode"
conditions are met? That would of course mean that you couldn't
separate your unit tests into separate files.

Hope I'm making sense.

Best,
Robert

Reply via email to