Changeset 7887
- Timestamp:
- 04/01/07 01:22:59 (16 months ago)
- Location:
- dojo/trunk/tests
- Files:
-
- 5 added
- 3 modified
-
runner.html (modified) (2 diffs)
-
runner.js (modified) (6 diffs)
-
_browserRunner.js (modified) (5 diffs)
-
_sounds (added)
-
_sounds/doh.wav (added)
-
_sounds/dohaaa.wav (added)
-
_sounds/LICENSE (added)
-
_sounds/woohoo.wav (added)
Legend:
- Unmodified
- Added
- Removed
-
dojo/trunk/tests/runner.html
r7847 r7887 13 13 }catch(e){ 14 14 document.write("<scr"+"ipt type='text/javascript' src='runner.js'></scr"+"ipt>"); 15 document.write("<scr"+"ipt type='text/javascript'>tests.selfTest = true;</scr"+"ipt>"); 15 16 document.write("<scr"+"ipt type='text/javascript' src='_browserRunner.js'></scr"+"ipt>"); 16 17 } … … 237 238 </tr> 238 239 </table> 240 <span id="hiddenAudio"></span> 239 241 </body> 240 242 </html> -
dojo/trunk/tests/runner.js
r7847 r7887 610 610 // gonna wait for an async result. It's up to the test code to trap 611 611 // errors and give us an errback or callback. 612 if(ret instanceof t his.Deferred){612 if(ret instanceof tests.Deferred){ 613 613 614 614 tg.inFlight++; … … 627 627 } 628 628 tests._testFinished(groupName, fixture, ret.results[0]); 629 if(tests._paused){ 630 // console.debug("finished deferred test group:", groupName, tests); 631 tests.run(); 632 } 629 633 } 630 634 … … 638 642 retEnd(); 639 643 }); 644 tests.pause(); 640 645 return ret; 641 646 } … … 654 659 // runs the specified test group 655 660 656 // FIXME: we need group status and individual tests to be async-able. Would657 // preferr, perhaps, avoiding use of the full Deferred system, but we'll658 // see what we can get away w/.659 661 var tg = this._groups[groupName]; 660 662 if(tg.skip === true){ return; } 661 663 if(this._isArray(tg)){ 664 if(idx<=tg.length){ 665 if(!tg.inFlight){ 666 tests._groupFinished(groupName, (!tg.failures)); 667 } 668 return; 669 } 662 670 tg.inFlight = 0; 663 671 tg.iterated = false; … … 672 680 } 673 681 tests._runFixture(groupName, tg[y]); 682 if(this._paused){ 683 this._currentTest = y+1; 684 if(this._currentTest == tg.length){ 685 tg.iterated = true; 686 } 687 this.debug("PAUSED at", this._currentGroup, this._currentTest); 688 return; 689 } 674 690 } 675 691 tg.iterated = true; … … 724 740 if(!found){ 725 741 found = true; 742 // console.debug("starting from:", x, ct); 726 743 this.runGroup(x, ct); 727 744 }else{ 728 745 this.runGroup(x); 729 746 } 747 if(this._paused){ return; } 730 748 } 731 749 } 732 750 this._currentGroup = null; 733 751 this._currentTest = null; 734 this._paused = true;752 this._paused = false; 735 753 this._onEnd(); 736 754 this._report(); -
dojo/trunk/tests/_browserRunner.js
r7880 r7887 213 213 } 214 214 215 var _playSound = function(name){ 216 byId("hiddenAudio").innerHTML = '<embed src="_sounds/'+name+'.wav" autostart="true" loop="false" hidden="true" width="1" height="1"></embed>'; 217 } 218 215 219 tests._testFinished = function(group, fixture, success){ 216 220 var fn = getFixtureNode(group, fixture); … … 218 222 fn.getElementsByTagName("td")[2].innerHTML = ((new Date())-fixture.startTime)+"ms"; 219 223 fn.className = (success) ? "success" : "failure"; 224 225 if(!success){ 226 _playSound("doh"); 227 } 220 228 } 221 229 this.debug(((success) ? "PASSED" : "FAILED"), "test:", fixture.name); … … 344 352 } 345 353 } 346 tests._onEnd = toggleRunning; 354 tests._onEnd = function(){ 355 toggleRunning(); 356 if(tests._failureCount == 0){ 357 alert("WOOHOO!!"); 358 tests.debug("WOOHOO!!"); 359 _playSound("woohoo"); 360 } 361 } 347 362 tests.run = (function(oldRun){ 348 363 return function(){ … … 369 384 } 370 385 tests._onEnd = function(){ 386 _tests._errorCount += tests._errorCount; 387 _tests._failureCount += tests._failureCount; 388 _tests._testCount += tests._testCount; 389 // should we be really adding raw group counts? 390 _tests._groupCount += tests._groupCount; 371 391 _tests.currentTestDeferred.callback(true); 372 392 } … … 385 405 _tests._testFinished(_thisGroup, f, s); 386 406 } 407 tests._report = function(){}; 387 408 } 388 409 }