Question about jqUnit for non-kettle apps...

Tony Atkins tony at raisingthefloor.org
Fri May 9 08:11:05 EDT 2014


Hi, All:

I am working on writing tests for things other than Kettle, such as express
and couchdb.  I have been using the following URLs as my starting template:

https://github.com/GPII/universal/blob/master/tests/all-tests.js
https://github.com/GPII/universal/blob/master/tests/DevelopmentTests.js

After a quick tour from Antranig, I managed to get to the point where I
could run a sanity check (1=1) test, but in doing so I noticed that there
are a quite a few apparent unstated assumptions.  You must have certain
structures to use the test harness, and the errors returned if you lack
these things are not at all intuitive.

Setting that aside, the key point is that I have two basic goals that I
have not yet been able to achieve:

*1.  I do not want to run kettle.*

I either want to know how not to run kettle at all, or how to create a
custom server.  If you omit the server from your test configuration, the
tests won't run at all.  I tried mocking kettle.server and using that
instead of kettle, but was unable to get that working either (the errors
were similar to those below, about "apply" methods on undefined).

*2.  I want to call my own setup and teardown code before and after my
tests.*

I would like to instantiate a pouchdb instance (for example) and then start
express before running my tests, and then tear down both after all tests
are run.  I can see that we have passthroughs to some qunit functions, but
not their setup and teardown functions.

I tried calling my own gpii-registered functions from testDefs.sequence,
that seems to expect a function that is derived from a particular prototype
that includes an "apply" function:

TypeError: Object #<Object> has no method 'apply'

    at Object.fluid.invokeGlobalFunction
> (/Users/duhrer/Source/rtf/rtf-terms-registry/express/node_modules/infusion/src/framework/core/js/Fluid.js:943:25)


I have been unable to find a good example or documentation where anything
like this is done, and could use some help.

If you'd like to see the code, it's here, and I have left it broken for now:

https://github.com/the-t-in-rtf/common-terms-registry

Don't worry about the million other things that I swear I am working to
clean up.  Just navigate to the "express" directory and run "node
tests/all-tests.js" to see the error.

Any ideas about what's wrong or (even better) suggestions about a
reasonable way to achieve the two goals (not running kettle, passing in
setup/teardown functions) would be greatly appreciated.

Thanks,


Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idrc.ocad.ca/pipermail/fluid-work/attachments/20140509/b222a0df/attachment.html>


More information about the fluid-work mailing list