~bcsaller/juju-gui/charmFind

« back to all changes in this revision

Viewing changes to lib/yui/docs/test/test-advanced-test-options.html

  • Committer: kapil.foss at gmail
  • Date: 2012-07-13 18:45:59 UTC
  • Revision ID: kapil.foss@gmail.com-20120713184559-2xl7be17egsrz0c9
reshape

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html>
2
 
<html lang="en">
3
 
<head>
4
 
    <meta charset="utf-8">
5
 
    <title>Example: Advanced Test Options</title>
6
 
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Maven+Pro:400,700">
7
 
    <link rel="stylesheet" href="../../build/cssgrids/grids-min.css">
8
 
    <link rel="stylesheet" href="../assets/css/main.css">
9
 
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
10
 
    <script src="../../build/yui/yui-min.js"></script>
11
 
</head>
12
 
<body>
13
 
 
14
 
<div id="doc">
15
 
    <h1>Example: Advanced Test Options</h1>
16
 
 
17
 
    
18
 
        <a href="#toc" class="jump">Jump to Table of Contents</a>
19
 
    
20
 
 
21
 
    <div class="yui3-g">
22
 
        <div class="yui3-u-3-4">
23
 
            <div id="main">
24
 
                <div class="content"><div class="intro">
25
 
<p>This example shows how to use advanced test options, which allow you to specify additional information about how a test should be run.
26
 
  Each <a href="index.html#testcase"><code>TestCase</code></a> can specify up to three different options for tests,
27
 
  including tests that should be ignored, tests that should throw an error, and tests that should fail.</p>
28
 
</div>
29
 
 
30
 
<div class="example yui3-skin-sam">
31
 
    <div id="testLogger"></div>
32
 
 
33
 
<script>
34
 
YUI().use('node', 'test-console', 'test', function (Y) {
35
 
 
36
 
    Y.namespace("example.test");
37
 
 
38
 
    Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
39
 
 
40
 
        //the name of the test case - if not provided, one is automatically generated
41
 
        name: "Advanced Options Tests",
42
 
 
43
 
        /*
44
 
         * Specifies tests that "should" be doing something other than the expected.
45
 
         */
46
 
        _should: {
47
 
 
48
 
            /*
49
 
             * Tests listed in here should fail, meaning that if they fail, the test
50
 
             * has passed. This is used mostly for YuiTest to test itself, but may
51
 
             * be helpful in other cases.
52
 
             */
53
 
            fail: {
54
 
 
55
 
                //the test named "testFail" should fail
56
 
                testFail: true
57
 
 
58
 
            },
59
 
 
60
 
            /*
61
 
             * Tests listed here should throw an error of some sort. If they throw an
62
 
             * error, then they are considered to have passed.
63
 
             */
64
 
            error: {
65
 
 
66
 
                /*
67
 
                 * You can specify "true" for each test, in which case any error will
68
 
                 * cause the test to pass.
69
 
                 */
70
 
                testGenericError: true,
71
 
 
72
 
                /*
73
 
                 * You can specify an error message, in which case the test passes only
74
 
                 * if the error thrown matches the given message.
75
 
                 */
76
 
                testStringError: "I'm a specific error message.",
77
 
                testStringError2: "I'm a specific error message.",
78
 
 
79
 
                /*
80
 
                 * You can also specify an error object, in which case the test passes only
81
 
                 * if the error thrown is on the same type and has the same message.
82
 
                 */
83
 
                testObjectError: new TypeError("Number expected."),
84
 
                testObjectError2: new TypeError("Number expected."),
85
 
                testObjectError3: new TypeError("Number expected.")
86
 
 
87
 
            },
88
 
 
89
 
            /*
90
 
             * Tests listed here should be ignored when the test case is run. For these tests,
91
 
             * setUp() and tearDown() are not called.
92
 
             */
93
 
            ignore : {
94
 
 
95
 
                testIgnore: true
96
 
 
97
 
            }
98
 
        },
99
 
 
100
 
        //-------------------------------------------------------------------------
101
 
        // Basic tests - all method names must begin with "test"
102
 
        //-------------------------------------------------------------------------
103
 
 
104
 
        testFail : function() {
105
 
 
106
 
            //force a failure - but since this test "should" fail, it will pass
107
 
            Y.Assert.fail("Something bad happened.");
108
 
 
109
 
        },
110
 
 
111
 
        testGenericError : function() {
112
 
            throw new Error("Generic error");
113
 
        },
114
 
 
115
 
        testStringError : function() {
116
 
 
117
 
            //throw a specific error message - this will pass because it "should" happen
118
 
            throw new Error("I'm a specific error message.");
119
 
        },
120
 
 
121
 
        testStringError2 : function() {
122
 
 
123
 
            //throw a specific error message - this will fail because the message isn't expected
124
 
            throw new Error("I'm a specific error message, but a wrong one.");
125
 
        },
126
 
 
127
 
        testObjectError : function() {
128
 
 
129
 
            //throw a specific error and message - this will pass because it "should" happen
130
 
            throw new TypeError("Number expected.");
131
 
        },
132
 
 
133
 
        testObjectError2 : function() {
134
 
 
135
 
            //throw a specific error and message - this will fail because the type doesn't match
136
 
            throw new Error("Number expected.");
137
 
        },
138
 
 
139
 
        testObjectError3 : function() {
140
 
 
141
 
            //throw a specific error and message - this will fail because the message doesn't match
142
 
            throw new TypeError("String expected.");
143
 
        },
144
 
 
145
 
        testIgnore : function () {
146
 
            alert("You'll never see this.");
147
 
        }
148
 
 
149
 
    });
150
 
 
151
 
 
152
 
    //create the console
153
 
    (new Y.Test.Console({
154
 
        newestOnTop : false,
155
 
        style: 'block' // to anchor in the example content
156
 
    })).render('#testLogger');
157
 
 
158
 
    Y.Test.Runner.add(Y.example.test.AdvancedOptionsTestCase);
159
 
 
160
 
    //run the tests
161
 
    Y.Test.Runner.run();
162
 
});
163
 
 
164
 
</script>
165
 
 
166
 
</div>
167
 
 
168
 
<h2 class="first" id="advanced-test-options">Advanced Test Options</h2>
169
 
 
170
 
<p>This example begins by creating a namespace and a <code>Y.Test.Case</code> object:</p>
171
 
<pre class="code prettyprint">Y.namespace(&quot;example.test&quot;);
172
 
Y.example.test.AdvancedOptionsTestCase = new Y.TestCase({
173
 
    name: &quot;Advanced Options Tests&quot;
174
 
});</pre>
175
 
 
176
 
 
177
 
<p>This <code>Y.Test.Case</code> serves as the basis for this example.</p>
178
 
 
179
 
<h3 id="using-_should">Using <code>_should</code></h3>
180
 
 
181
 
<p>Immediately after the <code>name</code> of the <code>Y.Test.Case</code> is defined, there is a <code>_should</code> property.
182
 
  This property specifies information about how tests <em>should</em> behave and is defined as an object literal with one
183
 
  or more of the following properties: <code>fail</code>, <code>error</code>, and <code>ignore</code>.Each of these three
184
 
  is also defined as an object literal whose property names map directly to the names of test methods in the <code>Y.Test.Case</code>.
185
 
  This example uses all three properties:</p>
186
 
<pre class="code prettyprint">Y.example.test.AdvancedOptionsTestCase = new Y.TestCase({
187
 
 
188
 
    &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
189
 
    name: &quot;Advanced Options Tests&quot;,
190
 
 
191
 
    &#x2F;*
192
 
     * Specifies tests that &quot;should&quot; be doing something other than the expected.
193
 
     *&#x2F;
194
 
    _should: {
195
 
 
196
 
        &#x2F;*
197
 
         * Tests listed in here should fail, meaning that if they fail, the test
198
 
         * has passed. This is used mostly for YuiTest to test itself, but may
199
 
         * be helpful in other cases.
200
 
         *&#x2F;
201
 
        fail: {
202
 
 
203
 
            &#x2F;&#x2F;the test named &quot;testFail&quot; should fail
204
 
            testFail: true
205
 
 
206
 
        },
207
 
 
208
 
        &#x2F;*
209
 
         * Tests listed here should throw an error of some sort. If they throw an
210
 
         * error, then they are considered to have passed.
211
 
         *&#x2F;
212
 
        error: {
213
 
 
214
 
            &#x2F;*
215
 
             * You can specify &quot;true&quot; for each test, in which case any error will
216
 
             * cause the test to pass.
217
 
             *&#x2F;
218
 
            testGenericError: true,
219
 
 
220
 
            &#x2F;*
221
 
             * You can specify an error message, in which case the test passes only
222
 
             * if the error thrown matches the given message.
223
 
             *&#x2F;
224
 
            testStringError: &quot;I&#x27;m a specific error message.&quot;,
225
 
            testStringError2: &quot;I&#x27;m a specific error message.&quot;,
226
 
 
227
 
            &#x2F;*
228
 
             * You can also specify an error object, in which case the test passes only
229
 
             * if the error thrown is on the same type and has the same message.
230
 
             *&#x2F;
231
 
            testObjectError: new TypeError(&quot;Number expected.&quot;),
232
 
            testObjectError2: new TypeError(&quot;Number expected.&quot;),
233
 
            testObjectError3: new TypeError(&quot;Number expected.&quot;)
234
 
 
235
 
        },
236
 
 
237
 
        &#x2F;*
238
 
         * Tests listed here should be ignored when the test case is run. For these tests,
239
 
         * setUp() and tearDown() are not called.
240
 
         *&#x2F;
241
 
        ignore : {
242
 
 
243
 
            testIgnore: true
244
 
 
245
 
        }
246
 
    },
247
 
 
248
 
    ...
249
 
});</pre>
250
 
 
251
 
 
252
 
<p>This <code>Y.Test.Case</code> specifies one test that should fail, six that should throw an error, and one that should be ignored.</p>
253
 
<p>In the <code>fail</code> section, the test method <code>testFail()</code> is specified as one that should fail. By adding the
254
 
  property <code>testFail</code> and settings its value to true, the <code>Y.Test.Runner</code> knows that this test is expected to fail.
255
 
  If the test were to be run without failing, it would be considered a failure of the test. This feature is useful when testing
256
 
  YUI Test itself or addon components to YUI Test.</p>
257
 
<p>Moving on to the <code>error</code> section, there are six tests specified that should throw an error. There are three different ways
258
 
  to indicate that a test is expected to throw an error. The first is simply to add a property with the same name as the test method
259
 
  and set its value equal to true (similar to specifying tests that should fail). In this example, the <code>testGenericError()</code>
260
 
  method is specified this way. When specified like this, the test passes regardless of the type of error that occurs. This can be
261
 
  dangerous since unexpected errors will also cause the test to pass. To be more specific, set the property value for the test method
262
 
  to an error message string. When a string is used instead of the Boolean true, the test passes only when an error is thrown and that
263
 
  error message matches the string. In this example, <code>testStringError()</code> and <code>testStringError2()</code> expect an error
264
 
  to be thrown with an error message of &quot;I'm a specific error message.&quot; If any other error occurs inside of the these methods,
265
 
  the test will fail because the error message doesn't match. The last way to specify an error should occur is to create an actual error
266
 
  object, which is the case with <code>testObjectError()</code>, <code>testObjectError2()</code>, and <code>testObjectError3()</code>.
267
 
  When specified in this way, a test will pass only when an error is thrown whose constructor and error message match that of the
268
 
  error object.</p>
269
 
<p>The last section is <code>ignore</code>, which determines tests that should be ignored. In this example, the method <code>testIgnore()</code>
270
 
  is set to be ignored when the <code>Y.Test.Case</code> is executed. Test in the <code>ignore</code> section are specified the same way
271
 
  as those in the <code>fail</code> section, by adding the name as a property and setting its value to true.</p>
272
 
 
273
 
<h3 id="creating-the-test-methods">Creating the test methods</h3>
274
 
 
275
 
<p>The next part of the example contains the actual test methods. Since each test method is specified as having a certain behavior in
276
 
  <code>_should</code>, they each do something to show their particular functionality.</p>
277
 
<p>The first method is <code>testFail()</code>, which does nothing but purposely fail. Since this method is specified as one that should
278
 
  fail, it means that this test will pass:</p>
279
 
<pre class="code prettyprint">Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
280
 
 
281
 
    &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
282
 
    name: &quot;Advanced Options Tests&quot;,
283
 
 
284
 
    ...
285
 
 
286
 
    testFail : function() {
287
 
 
288
 
        &#x2F;&#x2F;force a failure - but since this test &quot;should&quot; fail, it will pass
289
 
        Y.Assert.fail(&quot;Something bad happened.&quot;);
290
 
 
291
 
    },
292
 
 
293
 
    ...
294
 
});</pre>
295
 
 
296
 
<p>This method uses <code>Assert.fail()</code> to force the test to fail. This type of method is helpful if you are creating your own
297
 
  type of assert methods that should fail when certain data is passed in.</p>
298
 
<p>Next, the test methods that should error are defined.  The <code>testGenericError()</code> method is specified as needing to throw
299
 
  an error to pass. In the <code>error</code> section, <code>testGenericError</code> is set to true, meaning that any error causes
300
 
  this method to pass. To illustrate this, the method simply throws an error:</p>
301
 
<pre class="code prettyprint">Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
302
 
 
303
 
    &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
304
 
    name: &quot;Advanced Options Tests&quot;,
305
 
 
306
 
    ...
307
 
 
308
 
    testGenericError : function() {
309
 
        throw new Error(&quot;Generic error&quot;);
310
 
    },
311
 
 
312
 
    ...
313
 
});</pre>
314
 
 
315
 
<p>The fact that this method throws an error is enough to cause it to pass (the type of error and error message don't matter). The next
316
 
  two methods, <code>testStringError()</code> and <code>testStringError2()</code> are specified as throwing an error with a specific
317
 
  message (&quot;I'm a specific error message.&quot;):</p>
318
 
<pre class="code prettyprint">Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
319
 
 
320
 
    &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
321
 
    name: &quot;Advanced Options Tests&quot;,
322
 
 
323
 
    ...
324
 
 
325
 
    testStringError : function() {
326
 
 
327
 
        &#x2F;&#x2F;throw a specific error message - this will pass because it &quot;should&quot; happen
328
 
        throw new Error(&quot;I&#x27;m a specific error message.&quot;);
329
 
    },
330
 
 
331
 
    testStringError2 : function() {
332
 
 
333
 
        &#x2F;&#x2F;throw a specific error message - this will fail because the message isn&#x27;t expected
334
 
        throw new Error(&quot;I&#x27;m a specific error message, but a wrong one.&quot;);
335
 
    },
336
 
 
337
 
    ...
338
 
});</pre>
339
 
 
340
 
<p>The <code>testStringError()</code> method will pass when executed because the error message matches up exactly with the one
341
 
  specified in the <code>error</code> section. The <code>testStringError2()</code> method, however, will fail because its
342
 
  error message is different from the one specified.</p>
343
 
<p>To be more specific, <code>testObjectError()</code>, <code>testObjectError2()</code>, and <code>testObjectError3()</code>,
344
 
  specified an error type (<code>TypeError</code>) and an error messsage (&quot;Number expected.&quot;):</p>
345
 
<pre class="code prettyprint">Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
346
 
 
347
 
    &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
348
 
    name: &quot;Advanced Options Tests&quot;,
349
 
 
350
 
    ...
351
 
 
352
 
    testObjectError : function() {
353
 
 
354
 
        &#x2F;&#x2F;throw a specific error and message - this will pass because it &quot;should&quot; happen
355
 
        throw new TypeError(&quot;Number expected.&quot;);
356
 
    },
357
 
 
358
 
    testObjectError2 : function() {
359
 
 
360
 
        &#x2F;&#x2F;throw a specific error and message - this will fail because the type doesn&#x27;t match
361
 
        throw new Error(&quot;Number expected.&quot;);
362
 
    },
363
 
 
364
 
    testObjectError3 : function() {
365
 
 
366
 
        &#x2F;&#x2F;throw a specific error and message - this will fail because the message doesn&#x27;t match
367
 
        throw new TypeError(&quot;String expected.&quot;);
368
 
    },
369
 
 
370
 
    ...
371
 
});</pre>
372
 
 
373
 
<p>Of the these three methods, only <code>testObjectError()</code> will pass because it's the only one that throws a <code>TypeError</code>
374
 
  object with the message, &quot;Number expected.&quot; The <code>testObjectError2()</code> method will fail because the type of error
375
 
  being thrown (<code>Error</code>) is different from the expected type (<code>TypeError</code>), as specified in the <code>error</code>
376
 
  section. The last method, <code>testObjectError3()</code>, also fails. Though it throws the right type of error, the error message
377
 
  doesn't match the one that was specified.</p>
378
 
<p>The last method in the <code>Y.Test.Case</code> is <code>testIgnore()</code>, which is specified to be ignored. To be certain, this
379
 
  method pops up a message:</p>
380
 
<pre class="code prettyprint">Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
381
 
 
382
 
    &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
383
 
    name: &quot;Advanced Options Tests&quot;,
384
 
 
385
 
    ...
386
 
 
387
 
    testIgnore : function () {
388
 
        alert(&quot;You&#x27;ll never see this.&quot;);
389
 
    }
390
 
});</pre>
391
 
 
392
 
<p>If this test weren't ignored, then the alert should be displayed. Since it is ignored, though, you will never see the alert. Additionally,
393
 
  there is a special message displayed in the <code>Y.Console</code> when a test is ignored.</p>
394
 
 
395
 
<h3 id="running-the-tests">Running the tests</h3>
396
 
 
397
 
<p>With all of the tests defined, the last step is to run them:</p>
398
 
 
399
 
<pre class="code prettyprint">&#x2F;&#x2F;create the console
400
 
(new Y.Test.Console({
401
 
    verbose : true,
402
 
    newestOnTop : false
403
 
})).render(&#x27;#testLogger&#x27;);
404
 
 
405
 
&#x2F;&#x2F;add the test suite to the runner&#x27;s queue
406
 
Y.Test.Runner.add(Y.example.test.AdvancedOptionsTestCase);
407
 
 
408
 
&#x2F;&#x2F;run the tests
409
 
Y.Test.Runner.run();</pre>
410
 
 
411
 
 
412
 
<p>Before running the tests, it's necessary to create a <code>Y.Console</code> object to display the results (otherwise the tests would run
413
 
  but you wouldn't see the results). After that, the <code>Y.Test.Runner</code> is loaded with the <code>Y.Test.Suite</code> object by calling
414
 
  <code>add()</code> (any number of <code>Y.Test.Case</code> and <code>Y.Test.Suite</code> objects can be added to a <code>Y.Test.Runner</code>,
415
 
  this example only adds one for simplicity). The very last step is to call <code>run()</code>, which begins executing the tests in its
416
 
  queue and displays the results in the <code>Y.Console</code>.</p>
417
 
 
418
 
<h2 id="complete-example-source">Complete Example Source</h2>
419
 
 
420
 
<pre class="code prettyprint">&lt;div id=&quot;testLogger&quot;&gt;&lt;&#x2F;div&gt;
421
 
 
422
 
&lt;script&gt;
423
 
YUI().use(&#x27;node&#x27;, &#x27;test-console&#x27;, &#x27;test&#x27;, function (Y) {
424
 
 
425
 
    Y.namespace(&quot;example.test&quot;);
426
 
 
427
 
    Y.example.test.AdvancedOptionsTestCase = new Y.Test.Case({
428
 
 
429
 
        &#x2F;&#x2F;the name of the test case - if not provided, one is automatically generated
430
 
        name: &quot;Advanced Options Tests&quot;,
431
 
 
432
 
        &#x2F;*
433
 
         * Specifies tests that &quot;should&quot; be doing something other than the expected.
434
 
         *&#x2F;
435
 
        _should: {
436
 
 
437
 
            &#x2F;*
438
 
             * Tests listed in here should fail, meaning that if they fail, the test
439
 
             * has passed. This is used mostly for YuiTest to test itself, but may
440
 
             * be helpful in other cases.
441
 
             *&#x2F;
442
 
            fail: {
443
 
 
444
 
                &#x2F;&#x2F;the test named &quot;testFail&quot; should fail
445
 
                testFail: true
446
 
 
447
 
            },
448
 
 
449
 
            &#x2F;*
450
 
             * Tests listed here should throw an error of some sort. If they throw an
451
 
             * error, then they are considered to have passed.
452
 
             *&#x2F;
453
 
            error: {
454
 
 
455
 
                &#x2F;*
456
 
                 * You can specify &quot;true&quot; for each test, in which case any error will
457
 
                 * cause the test to pass.
458
 
                 *&#x2F;
459
 
                testGenericError: true,
460
 
 
461
 
                &#x2F;*
462
 
                 * You can specify an error message, in which case the test passes only
463
 
                 * if the error thrown matches the given message.
464
 
                 *&#x2F;
465
 
                testStringError: &quot;I&#x27;m a specific error message.&quot;,
466
 
                testStringError2: &quot;I&#x27;m a specific error message.&quot;,
467
 
 
468
 
                &#x2F;*
469
 
                 * You can also specify an error object, in which case the test passes only
470
 
                 * if the error thrown is on the same type and has the same message.
471
 
                 *&#x2F;
472
 
                testObjectError: new TypeError(&quot;Number expected.&quot;),
473
 
                testObjectError2: new TypeError(&quot;Number expected.&quot;),
474
 
                testObjectError3: new TypeError(&quot;Number expected.&quot;)
475
 
 
476
 
            },
477
 
 
478
 
            &#x2F;*
479
 
             * Tests listed here should be ignored when the test case is run. For these tests,
480
 
             * setUp() and tearDown() are not called.
481
 
             *&#x2F;
482
 
            ignore : {
483
 
 
484
 
                testIgnore: true
485
 
 
486
 
            }
487
 
        },
488
 
 
489
 
        &#x2F;&#x2F;-------------------------------------------------------------------------
490
 
        &#x2F;&#x2F; Basic tests - all method names must begin with &quot;test&quot;
491
 
        &#x2F;&#x2F;-------------------------------------------------------------------------
492
 
 
493
 
        testFail : function() {
494
 
 
495
 
            &#x2F;&#x2F;force a failure - but since this test &quot;should&quot; fail, it will pass
496
 
            Y.Assert.fail(&quot;Something bad happened.&quot;);
497
 
 
498
 
        },
499
 
 
500
 
        testGenericError : function() {
501
 
            throw new Error(&quot;Generic error&quot;);
502
 
        },
503
 
 
504
 
        testStringError : function() {
505
 
 
506
 
            &#x2F;&#x2F;throw a specific error message - this will pass because it &quot;should&quot; happen
507
 
            throw new Error(&quot;I&#x27;m a specific error message.&quot;);
508
 
        },
509
 
 
510
 
        testStringError2 : function() {
511
 
 
512
 
            &#x2F;&#x2F;throw a specific error message - this will fail because the message isn&#x27;t expected
513
 
            throw new Error(&quot;I&#x27;m a specific error message, but a wrong one.&quot;);
514
 
        },
515
 
 
516
 
        testObjectError : function() {
517
 
 
518
 
            &#x2F;&#x2F;throw a specific error and message - this will pass because it &quot;should&quot; happen
519
 
            throw new TypeError(&quot;Number expected.&quot;);
520
 
        },
521
 
 
522
 
        testObjectError2 : function() {
523
 
 
524
 
            &#x2F;&#x2F;throw a specific error and message - this will fail because the type doesn&#x27;t match
525
 
            throw new Error(&quot;Number expected.&quot;);
526
 
        },
527
 
 
528
 
        testObjectError3 : function() {
529
 
 
530
 
            &#x2F;&#x2F;throw a specific error and message - this will fail because the message doesn&#x27;t match
531
 
            throw new TypeError(&quot;String expected.&quot;);
532
 
        },
533
 
 
534
 
        testIgnore : function () {
535
 
            alert(&quot;You&#x27;ll never see this.&quot;);
536
 
        }
537
 
 
538
 
    });
539
 
 
540
 
 
541
 
    &#x2F;&#x2F;create the console
542
 
    (new Y.Test.Console({
543
 
        newestOnTop : false,
544
 
        style: &#x27;block&#x27; &#x2F;&#x2F; to anchor in the example content
545
 
    })).render(&#x27;#testLogger&#x27;);
546
 
 
547
 
    Y.Test.Runner.add(Y.example.test.AdvancedOptionsTestCase);
548
 
 
549
 
    &#x2F;&#x2F;run the tests
550
 
    Y.Test.Runner.run();
551
 
});
552
 
 
553
 
&lt;&#x2F;script&gt;</pre>
554
 
 
555
 
</div>
556
 
            </div>
557
 
        </div>
558
 
 
559
 
        <div class="yui3-u-1-4">
560
 
            <div class="sidebar">
561
 
                
562
 
                    <div id="toc" class="sidebox">
563
 
                        <div class="hd">
564
 
                            <h2 class="no-toc">Table of Contents</h2>
565
 
                        </div>
566
 
 
567
 
                        <div class="bd">
568
 
                            <ul class="toc">
569
 
<li>
570
 
<a href="#advanced-test-options">Advanced Test Options</a>
571
 
<ul class="toc">
572
 
<li>
573
 
<a href="#using-_should">Using <code>_should</code></a>
574
 
</li>
575
 
<li>
576
 
<a href="#creating-the-test-methods">Creating the test methods</a>
577
 
</li>
578
 
<li>
579
 
<a href="#running-the-tests">Running the tests</a>
580
 
</li>
581
 
</ul>
582
 
</li>
583
 
<li>
584
 
<a href="#complete-example-source">Complete Example Source</a>
585
 
</li>
586
 
</ul>
587
 
                        </div>
588
 
                    </div>
589
 
                
590
 
 
591
 
                
592
 
                    <div class="sidebox">
593
 
                        <div class="hd">
594
 
                            <h2 class="no-toc">Examples</h2>
595
 
                        </div>
596
 
 
597
 
                        <div class="bd">
598
 
                            <ul class="examples">
599
 
                                
600
 
                                    
601
 
                                        <li data-description="Demonstrates basic usage of YUI Test for setting up and running tests.">
602
 
                                            <a href="test-simple-example.html">Simple Testing Example</a>
603
 
                                        </li>
604
 
                                    
605
 
                                
606
 
                                    
607
 
                                        <li data-description="Demonstrates how to use advanced testing features such as defining tests that should fail, tests that should be ignored, and tests that should throw an error.">
608
 
                                            <a href="test-advanced-test-options.html">Advanced Test Options</a>
609
 
                                        </li>
610
 
                                    
611
 
                                
612
 
                                    
613
 
                                        <li data-description="Demonstrates how to use the ArrayAssert object to test array data.">
614
 
                                            <a href="test-array-tests.html">Array Processing</a>
615
 
                                        </li>
616
 
                                    
617
 
                                
618
 
                                    
619
 
                                        <li data-description="Demonstrates basic asynchronous tests.">
620
 
                                            <a href="test-async-test.html">Asynchronous Testing</a>
621
 
                                        </li>
622
 
                                    
623
 
                                
624
 
                                    
625
 
                                        <li data-description="Demonstrates using events with asynchronous tests.">
626
 
                                            <a href="test-async-event-tests.html">Asynchronous Event Testing</a>
627
 
                                        </li>
628
 
                                    
629
 
                                
630
 
                            </ul>
631
 
                        </div>
632
 
                    </div>
633
 
                
634
 
 
635
 
                
636
 
            </div>
637
 
        </div>
638
 
    </div>
639
 
</div>
640
 
 
641
 
<script src="../assets/vendor/prettify/prettify-min.js"></script>
642
 
<script>prettyPrint();</script>
643
 
 
644
 
</body>
645
 
</html>