/[jscoverage]/trunk/doc/example-jsunit/jsunit/testRunner.html
ViewVC logotype

Contents of /trunk/doc/example-jsunit/jsunit/testRunner.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 30 - (show annotations)
Sun Aug 19 04:45:14 2007 UTC (12 years, 4 months ago) by siliconforks
File MIME type: text/html
File size: 5150 byte(s)
Add jsunit example.

1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
2 <html>
3
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6 <title>JsUnit Test Runner</title>
7 <script language="JavaScript" type="text/javascript" src="app/xbDebug.js"></script>
8 <script language="JavaScript" type="text/javascript" src="app/jsUnitCore.js"></script>
9 <script language="JavaScript" type="text/javascript">
10 var DEFAULT_TEST_FRAME_HEIGHT = 250;
11
12 function jsUnitParseParms(string) {
13 var i;
14 var searchString = unescape(string);
15 var parameterHash = new Object();
16
17 if (!searchString) {
18 return parameterHash;
19 }
20
21 i = searchString.indexOf('?');
22 if (i != -1) {
23 searchString = searchString.substring(i + 1);
24 }
25
26 var parmList = searchString.split('&');
27 var a;
28 for (i = 0; i < parmList.length; i++) {
29 a = parmList[i].split('=');
30 a[0] = a[0].toLowerCase();
31 if (a.length > 1) {
32 parameterHash[a[0]] = a[1];
33 }
34 else {
35 parameterHash[a[0]] = true;
36 }
37 }
38 return parameterHash;
39 }
40
41 function jsUnitConstructTestParms() {
42 var p;
43 var parms = '';
44
45 for (p in jsUnitParmHash) {
46 var value = jsUnitParmHash[p];
47
48 if (!value ||
49 p == 'testpage' ||
50 p == 'autorun' ||
51 p == 'submitresults' ||
52 p == 'showtestframe' ||
53 p == 'resultid') {
54 continue;
55 }
56
57 if (parms) {
58 parms += '&';
59 }
60
61 parms += p;
62
63 if (typeof(value) != 'boolean') {
64 parms += '=' + value;
65 }
66 }
67 return escape(parms);
68 }
69
70 var jsUnitParmHash = jsUnitParseParms(document.location.search);
71
72 // set to true to turn debugging code on, false to turn it off.
73 xbDEBUG.on = jsUnitGetParm('debug') ? true : false;
74 </script>
75
76 <script language="JavaScript" type="text/javascript" src="app/jsUnitTestManager.js"></script>
77 <script language="JavaScript" type="text/javascript" src="app/jsUnitTracer.js"></script>
78 <script language="JavaScript" type="text/javascript" src="app/jsUnitTestSuite.js"></script>
79 <script language="JavaScript" type="text/javascript">
80
81 var testManager;
82 var utility;
83 var tracer;
84
85
86 if (!Array.prototype.push) {
87 Array.prototype.push = function (anObject) {
88 this[this.length] = anObject;
89 }
90 }
91
92 if (!Array.prototype.pop) {
93 Array.prototype.pop = function () {
94 if (this.length > 0) {
95 delete this[this.length - 1];
96 this.length--;
97 }
98 }
99 }
100
101 function shouldKickOffTestsAutomatically() {
102 return jsUnitGetParm('autorun') == "true";
103 }
104
105 function shouldShowTestFrame() {
106 return jsUnitGetParm('showtestframe');
107 }
108
109 function shouldSubmitResults() {
110 return jsUnitGetParm('submitresults');
111 }
112
113 function getResultId() {
114 if (jsUnitGetParm('resultid'))
115 return jsUnitGetParm('resultid');
116 return "";
117 }
118
119 function submitResults() {
120 window.mainFrame.mainData.document.testRunnerForm.runButton.disabled = true;
121 window.mainFrame.mainResults.populateHeaderFields(getResultId(), navigator.userAgent, JSUNIT_VERSION, testManager.resolveUserEnteredTestFileName());
122 window.mainFrame.mainResults.submitResults();
123 }
124
125 function wasResultUrlSpecified() {
126 return shouldSubmitResults() && jsUnitGetParm('submitresults') != 'true';
127 }
128
129 function getSpecifiedResultUrl() {
130 return jsUnitGetParm('submitresults');
131 }
132
133 function init() {
134 var testRunnerFrameset = document.getElementById('testRunnerFrameset');
135 if (shouldShowTestFrame() && testRunnerFrameset) {
136 var testFrameHeight;
137 if (jsUnitGetParm('showtestframe') == 'true')
138 testFrameHeight = DEFAULT_TEST_FRAME_HEIGHT;
139 else
140 testFrameHeight = jsUnitGetParm('showtestframe');
141 testRunnerFrameset.rows = '*,0,' + testFrameHeight;
142 }
143 testManager = new jsUnitTestManager();
144 tracer = new JsUnitTracer(testManager);
145 if (shouldKickOffTestsAutomatically()) {
146 window.mainFrame.mainData.kickOffTests();
147 }
148 }
149
150
151 </script>
152 </head>
153
154 <frameset id="testRunnerFrameset" rows="*,0,0" border="0" onload="init()">
155
156 <frame frameborder="0" name="mainFrame" src="./app/main-frame.html">
157 <frame frameborder="0" name="documentLoader" src="./app/main-loader.html">
158 <frame frameborder="0" name="testContainer" src="./app/testContainer.html">
159
160 <noframes>
161 <body>
162 <p>Sorry, JsUnit requires support for frames.</p>
163 </body>
164 </noframes>
165 </frameset>
166
167 </html>

  ViewVC Help
Powered by ViewVC 1.1.24