From b99970f8bc1a0cbec2c00f4eeafc8d97f0883edb Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Mon, 3 Jun 2013 01:57:42 -0400 Subject: [PATCH] Add nice little things to the in-browser test runner. 1. Add meta-links to the test name and new "more..." links. 2. Test name link runs that single test. more... shows the stack trace in an alert window. (Not ideal, but it's something.) --- auto_tests/misc/local.html | 4 ++++ auto_tests/misc/local.js | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/auto_tests/misc/local.html b/auto_tests/misc/local.html index 6bdb547..6950a0a 100644 --- a/auto_tests/misc/local.html +++ b/auto_tests/misc/local.html @@ -74,6 +74,10 @@ color: black; text-decoration: none; } + + .anchor:hover { + color:blue; + } diff --git a/auto_tests/misc/local.js b/auto_tests/misc/local.js index e8414ae..39a3cb5 100644 --- a/auto_tests/misc/local.js +++ b/auto_tests/misc/local.js @@ -152,13 +152,42 @@ DygraphsLocalTester.prototype.postResults = function() { tr.appendChild(tdResult); var tdName = document.createElement("td"); - tdName.innerText = result.name; + var div = document.createElement("div"); + div.innerText = result.name; + div.onclick = function(name) { + return function() { + var s = name.split("."); + var testCase = s[0]; + var testName = s[1]; + url = window.location.pathname + + "?testCaseName=" + testCase + + "&test=" + testName + + "&command=runTest"; + window.location.href = url; + }; + }(result.name); + div.setAttribute("class", "anchor"); + tdName.appendChild(div); tr.appendChild(tdName); var tdDuration = document.createElement("td"); tdDuration.innerText = result.duration; tr.appendChild(tdDuration); + if (result.e) { + var tdDetails = document.createElement("td"); + div = document.createElement("div"); + div.innerText = "more..."; + div.setAttribute("class", "anchor"); + div.onclick = function(e) { + return function() { + alert(e + "\n" + e.stack); + }; + }(result.e); + tdDetails.appendChild(div); + tr.appendChild(tdDetails); + } + table.appendChild(tr); } } @@ -211,7 +240,8 @@ DygraphsLocalTester.prototype.finish_ = function(tc, name, result, e) { this.results.push({ name : tc.name + "." + name, result : result, - duration : endms_ - this.startms_ + duration : endms_ - this.startms_, + e : e }); this.summary.passed += result ? 1 : 0; this.summary.failed += result ? 0 : 1; -- 2.7.4