JavaScript Test Library - properly terminate browser based test if uncaught exception occurs, no bug, not part of the build

This commit is contained in:
bclary%bclary.com 2006-06-22 06:44:45 +00:00
parent 92309f83aa
commit 9fc23fb5a4
15 changed files with 141 additions and 29 deletions

View File

@ -117,6 +117,10 @@ function reportSuccess(section, expected, actual)
function reportError(msg, page, line)
{
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof SUMMARY == 'undefined')
{
@ -150,6 +154,9 @@ function reportError(msg, page, line)
}
reportFailure(SECTION, msg);
gDelayTestDriverEnd = false;
jsTestDriverEnd();
};
@ -219,6 +226,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -115,6 +115,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -150,6 +154,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
var gVersion = 0;
@ -175,6 +183,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -114,6 +114,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -149,6 +153,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
var gVersion = 0;
@ -174,6 +182,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -121,6 +121,10 @@ var _reportFailure = reportFailure;
reportFailure = function (msg, page, line)
{
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (gInReportCompare)
{
@ -160,6 +164,9 @@ reportFailure = function (msg, page, line)
_reportFailure(msg);
}
gDelayTestDriverEnd = false;
jsTestDriverEnd();
};
function quit()
@ -181,6 +188,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -102,5 +102,34 @@ function outputscripttag(src, attribute, value, ise4x)
document.write(s);
}
function jsTestDriverEnd()
{
// gDelayTestDriverEnd is used to
// delay collection of the test result and
// signal to Spider so that tests can continue
// to run after page load has fired. They are
// responsible for setting gDelayTestDriverEnd = true
// then when completed, setting gDelayTestDriverEnd = false
// then calling jsTestDriverEnd()
if (gDelayTestDriverEnd)
{
return;
}
if (window.opener && window.opener.runNextTest)
{
if (window.opener.reportCallBack)
{
window.opener.reportCallBack(window.opener.gWindow);
}
setTimeout('window.opener.runNextTest()', 250);
}
else
{
gPageCompleted = true;
}
}
init();

View File

@ -1,32 +1,3 @@
function jsTestDriverEnd()
{
// gDelayTestDriverEnd is used to
// delay collection of the test result and
// signal to Spider so that tests can continue
// to run after page load has fired. They are
// responsible for setting gDelayTestDriverEnd = true
// then when completed, setting gDelayTestDriverEnd = false
// then calling jsTestDriverEnd()
if (gDelayTestDriverEnd)
{
return;
}
if (window.opener && window.opener.runNextTest)
{
if (window.opener.reportCallBack)
{
window.opener.reportCallBack(window.opener.gWindow);
}
setTimeout('window.opener.runNextTest()', 250);
}
else
{
gPageCompleted = true;
}
}
jsTestDriverEnd();

View File

@ -110,6 +110,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -145,6 +149,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
function version(v) {
@ -168,6 +176,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -114,6 +114,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -149,6 +153,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
var gVersion = 0;
@ -174,6 +182,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -114,6 +114,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -149,6 +153,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
function version(v)
@ -172,6 +180,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -113,6 +113,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -148,6 +152,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
var gVersion = 0;
@ -173,6 +181,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -121,6 +121,10 @@ var _reportFailure = reportFailure;
reportFailure = function (msg, page, line)
{
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (gInReportCompare)
{
@ -157,6 +161,9 @@ reportFailure = function (msg, page, line)
}
_reportFailure(msg);
gDelayTestDriverEnd = false;
jsTestDriverEnd();
};
function gc()
@ -172,6 +179,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -122,6 +122,10 @@ var _reportFailure = reportFailure;
reportFailure = function (msg, page, line)
{
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (gInReportCompare)
{
@ -161,6 +165,9 @@ reportFailure = function (msg, page, line)
_reportFailure(msg);
}
gDelayTestDriverEnd = false;
jsTestDriverEnd();
};
function gc()
@ -176,6 +183,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -122,6 +122,10 @@ var _reportFailure = reportFailure;
reportFailure = function (msg, page, line)
{
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (gInReportCompare)
{
@ -161,6 +165,9 @@ reportFailure = function (msg, page, line)
_reportFailure(msg);
}
gDelayTestDriverEnd = false;
jsTestDriverEnd();
};
function gc()
@ -176,6 +183,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -119,6 +119,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -154,6 +158,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
var gVersion = 0;
@ -179,6 +187,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)

View File

@ -112,6 +112,10 @@ var gExceptionExpected = false;
function err( msg, page, line ) {
var testcase;
var jsOptions = new JavaScriptOptions();
jsOptions.setOption('strict', false);
jsOptions.setOption('werror', false);
if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
/*
@ -147,6 +151,10 @@ function err( msg, page, line ) {
testcase.reason += "Error: " + msg +
" Source File: " + page + " Line: " + line + ".";
stopTest();
gDelayTestDriverEnd = false;
jsTestDriverEnd();
}
var gVersion = 0;
@ -172,6 +180,7 @@ function gc()
}
catch(ex)
{
writeLineToLog('gc: ' + ex);
// Thanks to igor.bukanov@gmail.com
var tmp = Math.PI * 1e500, tmp2;
for (var i = 0; i != 1 << 15; ++i)