www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 549fa4a508aed7aaae905703918f371da9c92943
parent 394ad64091122276fdd88f8fd154048ac9b8b0ac
Author: Simon Kornblith <simon@simonster.com>
Date:   Mon, 20 Feb 2012 02:06:33 -0500

Make translator tester time out after 10 minutes, add partial failure condition in tester pane, and rename "Unknown" to the more descriptive "Data Mismatch"

Diffstat:
Mchrome/content/zotero/tools/testTranslators/testTranslators.css | 8++++++--
Mchrome/content/zotero/tools/testTranslators/testTranslators.js | 17++++++++++-------
Mchrome/content/zotero/tools/testTranslators/translatorTester.js | 12+++++++++++-
3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/chrome/content/zotero/tools/testTranslators/testTranslators.css b/chrome/content/zotero/tools/testTranslators/testTranslators.css @@ -26,7 +26,7 @@ td, th { width: 100px; } -.th-pending, .th-supported, .th-succeeded, .th-failed, .th-unknown { +.th-pending, .th-supported, .th-succeeded, .th-failed, .th-mismatch { width: 75px; } @@ -38,7 +38,7 @@ td, th { background-color: #ff9090; } -.status-unknown { +.status-mismatch { background-color: #FFB; } @@ -50,6 +50,10 @@ td, th { background-color: #9FF; } +.status-partial-failure { + background-color: rgb(249, 180, 98); +} + tr.output-displayed > td { background-color: #b4d5ff !important; } diff --git a/chrome/content/zotero/tools/testTranslators/testTranslators.js b/chrome/content/zotero/tools/testTranslators/testTranslators.js @@ -25,7 +25,7 @@ const NUM_CONCURRENT_TESTS = 6; const TRANSLATOR_TYPES = ["Web", "Import", "Export", "Search"]; -const TABLE_COLUMNS = ["Translator", "Supported", "Status", "Pending", "Succeeded", "Failed", "Unknown"]; +const TABLE_COLUMNS = ["Translator", "Supported", "Status", "Pending", "Succeeded", "Failed", "Mismatch"]; var translatorTables = {}, translatorTestViews = {}, translatorTestViewsToRun = {}, @@ -89,7 +89,7 @@ var TranslatorTestView = function(translator, type) { this._status = document.createElement("td"); row.appendChild(this._status); - // Unknown + // Pending this._pending = document.createElement("td"); row.appendChild(this._pending); @@ -101,7 +101,7 @@ var TranslatorTestView = function(translator, type) { this._failed = document.createElement("td"); row.appendChild(this._failed); - // Unknown + // Mismatch this._unknown = document.createElement("td"); row.appendChild(this._unknown); @@ -212,15 +212,18 @@ TranslatorTestView.prototype.updateStatus = function(obj, status) { } else { this._status.textContent = "Not Run"; } + } else if((succeeded || unknown) && failed) { + this._status.className = "status-partial-failure"; + this._status.textContent = "Partial Failure"; } else if(failed) { this._status.className = "status-failed"; - this._status.textContent = "Failed"; + this._status.textContent = "Failure"; } else if(unknown) { - this._status.className = "status-unknown"; - this._status.textContent = "Unknown"; + this._status.className = "status-mismatch"; + this._status.textContent = "Data Mismatch"; } else { this._status.className = "status-succeeded"; - this._status.textContent = "Succeeded"; + this._status.textContent = "Success"; } } else { this._status.className = "status-untested"; diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -23,6 +23,9 @@ ***** END LICENSE BLOCK ***** */ +// Timeout for test to complete +const TEST_RUN_TIMEOUT = 600000; + var Zotero_TranslatorTester_IGNORE_FIELDS = ["complete", "accessDate", "checkFields"]; /** @@ -137,14 +140,17 @@ Zotero_TranslatorTester.prototype.runTests = function(testDoneCallback, recursiv * @param {Function} testDoneCallback A callback to be executed each time a test is complete */ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallback) { - var test = this.pending.shift(); var testNumber = this.tests.length-this.pending.length; var me = this; this._debug(this, "\nTranslatorTester: Running "+this.translator.label+" Test "+testNumber); + var executedCallback = false; var callback = function(obj, test, status, message) { + if(executedCallback) return; + executedCallback = true; + me._debug(this, "TranslatorTester: "+me.translator.label+" Test "+testNumber+": "+status+" ("+message+")"); me[status].push(test); if(testDoneCallback) testDoneCallback(me, test, status, message); @@ -156,6 +162,10 @@ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallba } else { this.runTest(test, null, callback); } + + window.setTimeout(function() { + callback(me, test, "failed", "Test timed out after "+TEST_RUN_TIMEOUT+" seconds"); + }, TEST_RUN_TIMEOUT); }; /**