You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2009/10/12 06:59:59 UTC

svn commit: r824224 - /couchdb/trunk/share/www/script/couch_test_runner.js

Author: jchris
Date: Mon Oct 12 04:59:58 2009
New Revision: 824224

URL: http://svn.apache.org/viewvc?rev=824224&view=rev
Log:
link to submit test failures to a google group

Modified:
    couchdb/trunk/share/www/script/couch_test_runner.js

Modified: couchdb/trunk/share/www/script/couch_test_runner.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_test_runner.js?rev=824224&r1=824223&r2=824224&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/couch_test_runner.js (original)
+++ couchdb/trunk/share/www/script/couch_test_runner.js Mon Oct 12 04:59:58 2009
@@ -142,9 +142,63 @@
     var text = $(this).text();
     totalDuration += parseInt(text.substr(0, text.length - 2), 10);
   });
-  $("#tests tbody.footer td").text(testsRun.length + " of " + tests.length +
+  $("#tests tbody.footer td").html("<span>"+testsRun.length + " of " + tests.length +
     " test(s) run, " + testsFailed.length + " failures (" +
-    totalDuration + " ms)");
+    totalDuration + " ms)</span> ");
+  if (testsFailed.length > 0) {
+    $("#tests tbody.footer td").append($('<a href="#">Click to Report Test Failures</a>').click(function(e) {
+      e.preventDefault();
+      reportTests();
+    }));
+  }
+}
+
+
+function testReport() {
+  var report = [];
+  report.push(testPlatform()+"\n");
+  $("#tests tbody.content tr").each(function() {
+    var status = $("td.status", this).text();
+    if (status != "not run") {
+      var dur = $("td.duration", this).text();
+      report.push(this.id+"\n  "+status+" "+dur);
+      var details = [];
+      $("td.details li", this).each(function() {
+        report.push("    "+$(this).text());
+      });
+    }
+  });
+  return report.join("\n");
+};
+
+function testPlatform() {
+  var b = $.browser;
+  var bs = ["mozilla", "msie", "opera", "safari"];
+  for (var i=0; i < bs.length; i++) {
+    if (b[bs[i]]) {
+      return "Platform: "+ bs[i] + " " + b.version;
+    }
+  };
+}
+
+
+function reportTests() {
+  var summary = $("#tests tbody.footer td span").text();
+  var report = testReport();
+  var uri = "http://groups.google.com/group/couchdb-test-report/post"
+    + "?subject=" + escape(summary);  
+
+  var d=document;
+  var f=d.createElement("form");
+  // f.style.display='none';
+  f.action=uri;
+  f.method="POST";f.target="_blank";
+  var t=d.createElement("textarea");
+  t.name="body";
+  t.value=report;
+  f.appendChild(t);
+  d.body.appendChild(f);
+  f.submit();
 }
 
 // Use T to perform a test that returns false on failure and if the test fails,
@@ -157,8 +211,9 @@
       if ($("td.details ol", currentRow).length == 0) {
         $("<ol></ol>").appendTo($("td.details", currentRow));
       }
+      var message = (arg2 != null ? arg2 : arg1).toString();
       $("<li><b>Assertion " + (testName ? "'" + testName + "'" : "") + " failed:</b> <code class='failure'></code></li>")
-        .find("code").text((arg2 != null ? arg2 : arg1).toString()).end()
+        .find("code").text(message).end()
         .appendTo($("td.details ol", currentRow));
     }
     numFailures += 1



Re: svn commit: r824224 - /couchdb/trunk/share/www/script/couch_test_runner.js

Posted by Paul Davis <pa...@gmail.com>.
On Mon, Oct 12, 2009 at 1:04 AM, Chris Anderson <jc...@apache.org> wrote:
> On Sun, Oct 11, 2009 at 9:59 PM,  <jc...@apache.org> wrote:
>> Author: jchris
>> Date: Mon Oct 12 04:59:58 2009
>> New Revision: 824224
>>
>> URL: http://svn.apache.org/viewvc?rev=824224&view=rev
>> Log:
>> link to submit test failures to a google group
>>
>
> This is an experimental feature Jan and I talked about over the
> weekend. This patch adds a link to the bottom of the test runner to
> paste the log of the test suite to a Google group. Ideally this would
> log test runs to the local CouchDB, and make it easy to replicate to a
> CouchDB hosted on Apache.org, but for the time being, I just wanted to
> get it started.
>
> Chris
>
> --
> Chris Anderson
> http://jchrisa.net
> http://couch.io
>

Having them sent to a CouchDB node running at Apache would also be way
cool. I'm not sure I see the need to have them sit in a local db first
though. Plus that just adds another interaction step and so on. Still,
cool idea.

Paul

Re: svn commit: r824224 - /couchdb/trunk/share/www/script/couch_test_runner.js

Posted by Chris Anderson <jc...@apache.org>.
On Sun, Oct 11, 2009 at 9:59 PM,  <jc...@apache.org> wrote:
> Author: jchris
> Date: Mon Oct 12 04:59:58 2009
> New Revision: 824224
>
> URL: http://svn.apache.org/viewvc?rev=824224&view=rev
> Log:
> link to submit test failures to a google group
>

This is an experimental feature Jan and I talked about over the
weekend. This patch adds a link to the bottom of the test runner to
paste the log of the test suite to a Google group. Ideally this would
log test runs to the local CouchDB, and make it easy to replicate to a
CouchDB hosted on Apache.org, but for the time being, I just wanted to
get it started.

Chris

-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Re: svn commit: r824224 - /couchdb/trunk/share/www/script/couch_test_runner.js

Posted by Paul Davis <pa...@gmail.com>.
On Mon, Oct 12, 2009 at 12:59 AM,  <jc...@apache.org> wrote:
> Author: jchris
> Date: Mon Oct 12 04:59:58 2009
> New Revision: 824224
>
> URL: http://svn.apache.org/viewvc?rev=824224&view=rev
> Log:
> link to submit test failures to a google group
>
> Modified:
>    couchdb/trunk/share/www/script/couch_test_runner.js
>
> Modified: couchdb/trunk/share/www/script/couch_test_runner.js
> URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_test_runner.js?rev=824224&r1=824223&r2=824224&view=diff
> ==============================================================================
> --- couchdb/trunk/share/www/script/couch_test_runner.js (original)
> +++ couchdb/trunk/share/www/script/couch_test_runner.js Mon Oct 12 04:59:58 2009
> @@ -142,9 +142,63 @@
>     var text = $(this).text();
>     totalDuration += parseInt(text.substr(0, text.length - 2), 10);
>   });
> -  $("#tests tbody.footer td").text(testsRun.length + " of " + tests.length +
> +  $("#tests tbody.footer td").html("<span>"+testsRun.length + " of " + tests.length +
>     " test(s) run, " + testsFailed.length + " failures (" +
> -    totalDuration + " ms)");
> +    totalDuration + " ms)</span> ");
> +  if (testsFailed.length > 0) {
> +    $("#tests tbody.footer td").append($('<a href="#">Click to Report Test Failures</a>').click(function(e) {
> +      e.preventDefault();
> +      reportTests();
> +    }));
> +  }
> +}
> +
> +
> +function testReport() {
> +  var report = [];
> +  report.push(testPlatform()+"\n");
> +  $("#tests tbody.content tr").each(function() {
> +    var status = $("td.status", this).text();
> +    if (status != "not run") {
> +      var dur = $("td.duration", this).text();
> +      report.push(this.id+"\n  "+status+" "+dur);
> +      var details = [];
> +      $("td.details li", this).each(function() {
> +        report.push("    "+$(this).text());
> +      });
> +    }
> +  });
> +  return report.join("\n");
> +};
> +
> +function testPlatform() {
> +  var b = $.browser;
> +  var bs = ["mozilla", "msie", "opera", "safari"];
> +  for (var i=0; i < bs.length; i++) {
> +    if (b[bs[i]]) {
> +      return "Platform: "+ bs[i] + " " + b.version;
> +    }
> +  };
> +}
> +
> +
> +function reportTests() {
> +  var summary = $("#tests tbody.footer td span").text();
> +  var report = testReport();
> +  var uri = "http://groups.google.com/group/couchdb-test-report/post"
> +    + "?subject=" + escape(summary);
> +
> +  var d=document;
> +  var f=d.createElement("form");
> +  // f.style.display='none';
> +  f.action=uri;
> +  f.method="POST";f.target="_blank";
> +  var t=d.createElement("textarea");
> +  t.name="body";
> +  t.value=report;
> +  f.appendChild(t);
> +  d.body.appendChild(f);
> +  f.submit();
>  }
>
>  // Use T to perform a test that returns false on failure and if the test fails,
> @@ -157,8 +211,9 @@
>       if ($("td.details ol", currentRow).length == 0) {
>         $("<ol></ol>").appendTo($("td.details", currentRow));
>       }
> +      var message = (arg2 != null ? arg2 : arg1).toString();
>       $("<li><b>Assertion " + (testName ? "'" + testName + "'" : "") + " failed:</b> <code class='failure'></code></li>")
> -        .find("code").text((arg2 != null ? arg2 : arg1).toString()).end()
> +        .find("code").text(message).end()
>         .appendTo($("td.details ol", currentRow));
>     }
>     numFailures += 1
>
>
>

Awesome idea. Though, I'd vote for creating an Appengine app to allow
things like counts per browser and test and searching and more
awesome. Emails seem like I'm gonna ignore them after five.

Paul