bug 379327 - have mochitest print test filename in FAIL lines. r=sayrer
authorted.mielczarek@gmail.com
Tue, 04 Sep 2007 06:02:34 -0700
changeset 5630 31d545e4c084fea59d63aad96b2dd211c6894ef8
parent 5629 5367c71006e2463c02611eb63cb292faf758ed3b
child 5631 98ba55a2a24c40c7707561a98ae8251119baabf6
push idunknown
push userunknown
push dateunknown
reviewerssayrer
bugs379327
milestone1.9a8pre
bug 379327 - have mochitest print test filename in FAIL lines. r=sayrer
testing/mochitest/tests/SimpleTest/SimpleTest.js
testing/mochitest/tests/SimpleTest/TestRunner.js
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -60,27 +60,31 @@ SimpleTest.todo = function(condition, na
   if (SimpleTest._logEnabled)
       SimpleTest._logResult(test, "TODO WORKED?", "TODO");
   SimpleTest._tests.push(test);
 }
 
 SimpleTest._logResult = function(test, passString, failString) {
   var msg = test.result ? passString : failString;
   msg += " | " + test.name;
+  var url = "";
+  if (parentRunner.currentTestURL)
+    url = " | " + parentRunner.currentTestURL;
+
   if (test.result) {
       if (test.todo)
-          parentRunner.logger.error(msg)
+          parentRunner.logger.error(msg + url)
       else
           parentRunner.logger.log(msg);
   } else {
       msg += " | " + test.diag;
       if (test.todo)
           parentRunner.logger.log(msg)
       else
-          parentRunner.logger.error(msg);
+          parentRunner.logger.error(msg + url);
   }
 }
 
 /**
  * Copies of is and isnot with the call to ok replaced by a call to todo.
 **/
 
 SimpleTest.todo_is = function (a, b, name) {
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -4,16 +4,17 @@
  * 
  *  * Avoid moving iframes: That causes reloads on mozilla and opera.
  *
  *
 **/
 var TestRunner = {};
 TestRunner.logEnabled = false;
 TestRunner._currentTest = 0;
+TestRunner.currentTestURL = "";
 TestRunner._urls = [];
 
 /**
  * Make sure the tests don't hang. Runs every 300 seconds, but it will
  * take up to 360 seconds to detect a hang.
 **/
 TestRunner._testCheckPoint = -1;
 TestRunner._checkForHangs = function() {
@@ -81,16 +82,18 @@ TestRunner.runTests = function (/*url...
 };
 
 /**
  * Run the next test. If no test remains, calls makeSummary
 **/
 TestRunner.runNextTest = function() {
     if (TestRunner._currentTest < TestRunner._urls.length) {
         var url = TestRunner._urls[TestRunner._currentTest];
+        TestRunner.currentTestURL = url;
+
         $("current-test-path").innerHTML = url;
         
         if (TestRunner.logEnabled)
             TestRunner.logger.log("Running " + url + "...");
         
         TestRunner._makeIframe(url);
     }  else {
         $("current-test").innerHTML = "<b>Finished</b>";