• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

css/H28-Aug-2020-1,005863

dojo/H03-May-2022-220,702210,720

hlp/H28-Aug-2020-7867

img/H03-May-2022-

js/mcc/H28-Aug-2020-

README.unittestsH A D28-Aug-20204.5 KiB10986

README.unittests

1Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is also distributed with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation.  The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
22
23
24================================================================================
25              Running unit tests with Dojo Object Harness (DOH)
26================================================================================
27
281. Dojo src/sdk
29--------------------------------------------------------------------------------
30To get access to doh, make a src version of dojo available (softlink or
31whatever) at configurator/frontend/dojo.src.
32
332. Source code modules and unit tests
34--------------------------------------------------------------------------------
35The mcc source is divided into modules with submodules that are reflected in
36the directory structure. E.g., the utility module is called "mcc.util" and
37resides in frontend/js/mcc/util.js. Its submodules are located in the
38javascript files in the directory frontend/js/mcc/util/. Further down, in
39frontend/js/mcc/util/tests, the unit test files for the util module (and its
40submodules) are located.
41
42Javascript modules (example):
43
44mcc.util                // Public interface of submodules
45mcc.util.html           // One out of several submodules
46mcc.util.tests.util     // Collection of all util unit tests
47mcc.util.tests.html     // Unit tests for the html submodule
48
49Directory structure (example):
50
51frontend->
52    js->
53        mcc->
54            util.js
55            util->
56                html.js
57                tests->
58                    html.js
59                    util.js
60                    runTest.html
61
62Tests can be run in a browser by invoking doh through "runner.js". This is
63done by html files that can be opened in a browser and just redirects the
64browser to the appropriate URL. These html files are locate in the tests
65directories, and are called "runTest.html". Note that runTest redirects to
66a url which assumes dojo is available at "dojo.src", that's why the dojo
67source version should be located in a directory with the name and location
68as described above.
69
703. Unit tests and dijit widgets
71--------------------------------------------------------------------------------
72Much of the code is tightly coupled to the dijit widgets, and hence hard to test
73without a browser environment. Unit tests in need of a browser environment with
74a document to manipulate is run with a special html page which doh sets up to
75run in a separate frame. E.g., to continue the example from the previous
76section, the mcc.util.html module has some code that can be tested without a
77gui, and some code in need of one. The code for the gui-related unit tests is
78located in two additional files:
79
80Javascript modules (example, continued from above):
81
82mcc.util                    // Public interface of submodules
83mcc.util.html               // One out of several submodules
84mcc.util.tests.util         // Collection of all util unit tests
85mcc.util.tests.html         // Unit tests for the html submodule
86mcc.util.tests.html_gui     // GUI unit tests for the html submodule
87
88Directory structure (example, continued from above):
89
90frontend->
91    js->
92        mcc->
93            util.js
94            util->
95                html.js
96                tests->
97                    html.js
98                    html_gui.js
99                    html_gui.html
100                    util.js
101                    runTest.html
102
103The mcc.util.tests.util module includes the gui related unit tests for the html
104module, so opening the runTest.html in a browser will run all unit tests for the
105util module, including the gui related tests.
106
107
108
109