Select to view content in your preferred language

Updated DOH example?

690
3
04-12-2013 08:26 PM
JohnCartwright
Deactivated User
Hello,

I'm looking at Derek's DOH unit testing example (http://blogs.esri.com/esri/arcgis/2012/05/21/writing-unit-tests-for-your-arcgis-api-for-javascript-a...) and cannot get it to work with version 3.x of the API.

Can someone please help me out?

Thanks!

--john
0 Kudos
3 Replies
mykLT
by
Occasional Contributor
I've managed to run DOH like this:
http://localhost/dojo/util/doh/runner.html?test=your/test/module&boot=path/to/testsConfig,path/to/arcgis/js/api


My tests config looks like this:
dojoConfig = require;
dojoConfig.packages = [{
 name: "doh",
 location: "path/to/dojo/util/doh",
 main: "main"
},{
 name: "testedPackage",
 location: "path/to/your/testedPackage",
 main: "main"
}];


I could recommend to view dojo/util/doh/_parseURLargs.js source to understand how modules are loaded. My solution have some issues, but it works.
0 Kudos
JohnCartwright
Deactivated User
Thanks for your reply!.  I've not been able to get your suggestion to work despite using a local dojo.  Would it be possible for you to modify Derek's original sample as a more complete illustration of your approach?

Thanks again for your interest and help!

--john
0 Kudos
mykLT
by
Occasional Contributor
Derek used old DOH and now it's refactored, so you should use the newest one.

It would be much easier if you write, how You've tried to run tests. Where does DOH script fail? What errors do you receive?

Firstly, You should try to run for eg. dojo source's tests. You can find them in dojo/tests. Run them like this:
http://localhost/dojo/util/doh/runner.html?test=dojo/tests/module . If it works, go on and try to add 'boot' parameter, custom configuration and your test module as I wrote before.
0 Kudos