From 4bd235f6ddcce66a6f0cba753702ff6f47088ccb Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Fri, 16 Jan 2009 10:51:15 +0000 Subject: Show total elapsed time in test suite. Closes COUCHDB-203. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@734968 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch_test_runner.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'share') diff --git a/share/www/script/couch_test_runner.js b/share/www/script/couch_test_runner.js index 09ba6f4d..31bd4a4a 100644 --- a/share/www/script/couch_test_runner.js +++ b/share/www/script/couch_test_runner.js @@ -41,7 +41,7 @@ function patchTest(fun) { function runAllTests() { var rows = $("#tests tbody.content tr"); - $("td", rows).html(" "); + $("td", rows).text(""); $("td.status", rows).removeClass("error").removeClass("failure").removeClass("success").text("not run"); var offset = 0; function runNext() { @@ -66,7 +66,7 @@ function runTest(button, callback, debug) { } var row = currentRow = $(button).parents("tr").get(0); $("td.status", row).removeClass("error").removeClass("failure").removeClass("success"); - $("td", row).html(" "); + $("td", row).text(""); var testFun = tests[row.id]; function run() { numFailures = 0; @@ -115,15 +115,14 @@ function showSource(cell) { function updateTestsListing() { for (var name in tests) { - if (!tests.hasOwnProperty(name)) continue; var testFunction = tests[name]; var row = $("") .find("th").text(name).attr("title", "Show source").click(function() { showSource(this); }).end() .find("td:nth(0)").addClass("status").text("not run").end() - .find("td:nth(1)").addClass("duration").html(" ").end() - .find("td:nth(2)").addClass("details").html(" ").end(); + .find("td:nth(1)").addClass("duration").end() + .find("td:nth(2)").addClass("details").end(); $("").click(function() { this.blur(); runTest(this); @@ -139,8 +138,14 @@ function updateTestsFooter() { var tests = $("#tests tbody.content tr td.status"); var testsRun = tests.filter(".success, .error, .failure"); var testsFailed = testsRun.not(".success"); + var totalDuration = 0; + $("#tests tbody.content tr td.duration:contains('ms')").each(function() { + var text = $(this).text(); + totalDuration += parseInt(text.substr(0, text.length - 2), 10); + }); $("#tests tbody.footer td").text(testsRun.length + " of " + tests.length + - " test(s) run, " + testsFailed.length + " failures"); + " test(s) run, " + testsFailed.length + " failures (" + + totalDuration + " ms)"); } // Use T to perform a test that returns false on failure and if the test fails, -- cgit v1.2.3