Essentially I need help understanding this blog post:
http://www.sitepen.com/blog/2008/04/15/unit-testing-custom-code-with-the-dojo-objective-harness/
I want to use DOH to unit test an existing javascript project and I do not want to restructure that project to look like a Dojo widget. My project is structured like so:
project/
scripts/
doh/
...
tests/
testA.js
project.js
tests/
tests.html
index.html
tests.html is a page with a single link to:
../scripts/doh/runner.html?testModule=scripts.tests.testA
testA.js does not appear to be loading, and I'm not sure what code should go in it so that it loads correctly as a test suite and also has access to the classes defined in project.js.
Does your browser give any indication in its debugger tools as to whether it tried to load something called testA.js, and if so, where from?
If you have a path issue (it may be looking for 'scripts' as a sibling directory to your dojo directory), you can give DOH a hint in the runner URL as to how to map packages, e.g.
®isterModulePath=scripts,../../scripts
(this maps 'scripts' to '../../scripts'; you'll need to tweak that as appropriate as I can't see where your Dojo directory is)Typically, you point 'testModule' at a module file, which is a file which simply pulls in test fixtures, but I think you can get away with just pointing at a test fixture file itself. That just needs to call doh.register with some tests, and doh.run() to kick it all off.