Debian Codegraph @

util/doh/README

raw
1 DOH: The Dojo Object Harness
2 ============================
3
4 DOH is a unit test framework developed by the Dojo Toolkit Community. For the tutorial published
5 with the latest release see: http://dojotoolkit.org/reference-guide/util/doh.html#util-doh.
6
7 DOH is a constructed as an AMD package that uses doh/main.js for its main entry point. It may
8 be executed in the browser or by node.js or rhino. Typically, it is loaded by the dojo AMD
9 loader; however, it is also possible to use any complying loader.
10
11
12 node.js
13 =======
14
15 To run DOH via node.js, issue the command
16
17 > node path/to/dojo/dojo.js load=doh test=path/to/test/module
18
19 For example, from the util/doh/ directory you can run the self test as follows:
20
21 ~/dev/dojotoolkit/util/doh> node ../../dojo/dojo.js load=doh test=doh/tests/selfTest
22
23 Since node.js includes executing scripts to discover their location, the dojo node bootstrap
24 can discover baseUrl (the dojo directory) without further help.
25
26
27 rhino
28 =====
29
30 To run DOH via rhino, issue the command
31
32 >java -jar path/to/js.jar path/to/dojo/dojo.js baseUrl=path/to/dojo load=doh test=path/to/test/module
33
34 For example, from the util/doh/ directory, you can run the self test as follows (assumes js.jar is in the user's
35 home directory):
36
37 ~/dev/dojotoolkit/util/doh> java -jar ../shrinksafe/js.jar ../../dojo/dojo.js baseUrl=../../dojo load=doh test=doh/tests/selfTest
38
39 Since rhino does not give scripts the ability to discover their location, you must do one of the following
40
41 * provide a baseUrl command line argument that specifies the dojo directory
42 * execute the command form the the dojo directory
43
44 Here's the equivalent example command from the dojo directory:
45
46 ~/dev/dojotoolkit/dojo> java -jar ../util/shrinksafe/js.jar dojo.js load=doh test=doh/tests/selfTest
47
48
49 browser
50 =======
51
52 To run DOH in the browser, point your browser to util/DOH/runner.html. You'll also need to provide at least one
53 test module to execute by the query parameter "test". For example, to run the dojo unit tests, the URL would
54 look something like...
55
56 http://localhost/dev/dojotoolkit/util/doh/runner.html?test=dojo/tests/module
57
58 (Of course the host and path--localhost and dev/dojotoolkit/util in the example--will depend on how you've configured
59 your test environment.
60
61 DOH includes the following query parameters:
62
63 test:
64 a comma-separated-list of AMD module identifiers that contain the tests to load.
65
66 testUrl:
67 deprecated alias for test
68
69 paths:
70 a semicolon-separated-list of comma-separated-pairs of (module-identifier -> path-prefix) to provide to the loader's
71 path configuration property.
72
73 registerModulePath:
74 deprecated alias for paths
75
76 boot:
77 a comma-separated-list of Javascript resources to script inject to bootstrap DOH. Defaults to "../../dojo/dojo.js",
78 which causes DOH to use the dojo AMD loader. You may use this parameter to provide and alternate loader.
79
80 dojoUrl:
81 deprecated alias for boot
82
83 async:
84 If provided, instructs the dojo loader to operate in async mode.
85
86 breakOnError:
87 If provided, instructs DOH to break into the debugger upon an error.
88
89
90 About Hard Dojo Dependency
91 ==========================
92
93 As of v1.7 DOH depends on dojo base via AMD define dependency lists. If this causes you concern, you
94 may sandbox dojo by setting dojoConfig.scopeMap.dojo to falsy which will result in *not* publishing
95 dojo to the global namespace. Alternatively, you may provide a custom library that includes the
96 part of the dojo base API used by DOH and map the AMD module identifier "dojo" to this custom library.
97 However, we know of no good reason to follow either of these paths.