return [];
return "DebugObject";
this.debugWrite = jsTrue(args["debugWrite"]);
super.construct(parent, args);
dw("DebugObject.construct(", args, ")");
0 || s == "[object Object]") {
s = "";
for (var e in f) {
var i = f[e];
var v = this[i];
// Ignore "empty" properties
if (v && ("" + v) != "") {
s += "" + i + ": " + v + ", ";
}
}
if (s != "")
s = "{" + s.substring(0, s.length - 2) + "}";
}
return s;
]]>
return "Test";
return this.constructor.classname;
var f = super.debugFields();
return f.concat([ "result", "semantics" ]);
this.result = null;
super.construct(parent, args);
dw("Test.construct(", args, ")");
if (typeof(theTestResult) == "undefined") {
theTestResult = new TestResult();
} else {
this.result = theTestResult;
}
var suite = this.parent;
suite.ontestfail.sendEvent(message);
if (this.result) {
this.result.addFailure(message);
} else {
Debug.debug('result is null on fail call: "' + message + '"');
}
if ($debug) {
Debug.freshLine();
// create an error, which will include a backtrace, if applicable
Debug.__write(new LzError(null, null, message));
}
var suite = this.parent;
suite.ontestfail.sendEvent(message);
if (this.result) {
this.result.addError(message);
} else {
Debug.debug('result is null on error call: "' + message + '"');
}
if ($debug) {
Debug.freshLine();
// create an error, which will include a backtrace, if applicable
Debug.__write(new LzError(null, null, message));
}
return this.formatToString(
'%s expected %#w got %#w',
(jsTrue(message) ? message + ": " : ""), expected, actual);
var message = this.formatToString.apply(this, arguments);
if (this.result) {
this.result.addMessage(message);
}
if ($debug ) {
Debug.freshLine();
// create an error, which will include a backtrace, if applicable
Debug.__write(new LzInfo(null, null, message));
}
if (! semanticsTrue(condition)) {
this.fail(format(jsTrue(assertion) ? assertion : "True", true, condition));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (!! semanticsTrue(condition)) {
this.fail(format(jsTrue(assertion) ? assertion : "False", false, condition));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (! (expected == actual)) {
this.fail(format(jsTrue(message) ? message : "Equals", expected, actual));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (object !== null) {
this.fail(format(jsTrue(message) ? message : "Null",
null, object));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (object === null) {
this.fail(format(jsTrue(message) ? message : "NotNull",
"non-null value", object));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (typeof(object) != "undefined") {
this.fail(format(jsTrue(message) ? message : "Undefined",
"undefined value", object));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (typeof(object) == "undefined") {
this.fail(format(jsTrue(message) ? message : "NotUndefined",
"defined value", object));
}
canvas.setAttribute('runTests', canvas.runTests + 1)
if (expected === actual) {
// In-line Test.format so we can invert the sense
var msg = LzFormatter.prototype.formatToString(
'%s expected anything but %#w got %#w',
(jsTrue(message) ? message + ": " : "NotSame: "), expected, actual);
this.fail(msg);
}
canvas.setAttribute('runTests', canvas.runTests + 1)
return "TestCase";
var f = super.debugFields();
return f.concat([ "name" ]);
this.name = jsTrue(args["testName"]) ? args.testName : this.constructor.classname;
super.construct(parent, args);
dw("TestCase.construct(", args, ")");
dw("TestCase.run(", theTestName, ")");
setResult(theTestResult);
var dn = this._dbg_name instanceof Function ? this._dbg_name() : this._dbg_name;
var tn = this._dbg_typename instanceof Function ? this._dbg_typename() : this._dbg_typename;
var prefix = (dn != tn) ? dn + ' >>> ' : ''
this.result.startTest(prefix + theTestName);
setUp();
var wrapper = function (fn, ln, msg) {
with(arguments.callee.env) {
if (! inrsw) {
// TODO: [2002-11-16 ptw] fluid-bind
inrsw = true;
rsw.apply(this, arguments);
testcase.error(msg);
inrsw = false;
}
}
}
if ($debug) {
wrapper.env = {inrsw: false, rsw: $reportSourceWarning, testcase: this};
var savedrsw = $reportSourceWarning;
if (catchErrors) {
$reportSourceWarning = wrapper;
}
}
runTest(theTestName);
if ($debug) {
if (catchErrors) {
$reportSourceWarning = savedrsw;
}
}
tearDown();
return this.result;
if (typeof(theTestName) == "undefined") theTestName = name;
dw("TestCase.runTest(", theTestName, ")");
// Invoke the test method
var m = this[theTestName];
if (typeof(m) != "function") {
error("method '" + theTestName + "' not found", false);
}
else {
m.call(this);
}
var p = cur_meth.xpathQuery('@args')
var e = cur_meth.xpathQuery('@event')
if (!this['del'])
{
this.del = (typeof(e) != "undefined" ? new LzDelegate(this, '_handler',
tested_object, e) : new LzDelegate(this, '_handler'))
}
else if (typeof(e) != "undefined")
this.del.register(tested_object, e);
if (typeof(p) != "undefined")
tested_object[current_method](p, del)
else
tested_object[current_method](del)
callNext()
var o = cur_meth.xpathQuery('@tester')
if (typeof(o) != "undefined")
this[o](res);
else
inspect(res);
if (cur_meth.selectNext())
callNext()
return "TestResult";
this.failedTests = 0;
this.erroredTests = 0;
this.currentTest = null;
this.failures = [];
this.errors = [];
this.messages = [];
super.construct(parent, args);
dw("TestResult.construct(", args, ");");
this.currentTest = test;
update();
update()
var f = new TestFailure(currentTest, reason);
dw("TestResult.AddFailure(", f, ");");
this.failedTests++;
this.failures.push(f);
this.update();
var f = new TestError(currentTest, reason);
dw("TestResult.AddError(", f, ");");
this.erroredTests++;
errors.push(f);
update();
messages.push(readout.formatToString.apply(readout, arguments));
update();
var s = "Tests: " + this.totalTests +
" Failures: " + failedTests +
" Errors: " + erroredTests;
for (var i in failures)
s += "\n" + failures[i];
for (var i in errors)
s += "\n" + errors[i];
for (var i in messages)
s += "\n" + messages[i];
return s;
0) {
with (display.progress) {
var bw = background.width;
errorbar.setAttribute("width", bw * erroredTests / totalTests);
failbar.setAttribute("width", bw * totalBad / totalTests);
donebar.setAttribute("width", bw * totalTests / totalTests);
}
}
if (totalBad > 0) {
readout.setAttribute("bgcolor", red);
}
// TODO: [2002-11-10 ptw] setAttribute("text", ...) does not work?
readout.setAttribute("text", LzBrowser.xmlEscape(this.toString()));
]]>
Test Progress
Test Results
return "TestSuite";
var f = super.debugFields();
return f.concat([ "tests", "total", "inError", "defaultSourceWarning" ]);
//Debug.debug("onsuitefinish");
//this.resultstring += ("failures: "+ this.result.numFailures()+ "\n");
//this.resultstring += ("time: "+ (((new Date)['getTime']()) - this.starttime)+"\n");
this.resultstring += "finish_testsuite: "+this.testpath + " failures: "+ this.result.numFailures()+ "\n";
this.sendLogData(this.logfile, this.resultstring);
this.testStartTime = ((new Date)['getTime']());
var testcase = "testcase: "+tc+" "+((((new Date)['getTime']()) - this.testStartTime));
//this.resultstring += (testcase+"\n");
//this.resultstring += ("failure: "+msg+"\n");
if (this.nextCase == subviews.length)
{
this.nextCase = 0
dw("TestSuite.initSuite(", this, ")");
run()
}
else
{
var sv = subviews[this.nextCase];
dw("TestSuite.initSuite: subviews[", this.nextCase, "] = ", sv);
if (sv instanceof lz.TestCase)
{
for (var n in sv) {
var t = sv[n];
if (typeof(t) == "function") {
//--- /^test/.test(n)
if (n.indexOf("test") == 0) {
if (typeof(tests[this.nextCase]) == "undefined")
tests[this.nextCase] = [];
dw("tests[", this.nextCase, "].push(", n, ");");
tests[this.nextCase].push(n);
}
}
}
}
this.nextCase++
var del = new LzDelegate(this, "initSuite")
LzIdle.callOnIdle(del)
}
this.controlPanel.bringToFront(); // make sure we can see the control panel
dw("TestSuite.run()");
this.setResult(controlPanel.theTestResult);
dw("TestSuite.result = ", this.result);
dw("tests.length = ", tests.length);
this.nextCase = 0;
this.nextTest = 0;
if (asynchronousTests) {
runNextTest();
} else {
for (var v in this.tests) {
var tc = this.tests[v];
if (typeof(tc) != "undefined") {
dw("tc.length = ", tc.length);
for (var i in tc) {
dw("subviews[", v, "].run(", this.result, ", ", tc[i], ");");
subviews[v].run(this.result, tc[i]);
}
}
}
}
dw("TestSuite.result = ", this.result);
return this.result;
this.tests.length) {
this.onsuitefinish.sendEvent(this.result.numFailures() > 0 ? 'fail' : 'pass');
return false;
}
var tc = this.tests[v];
var i = this.nextTest++;
if (typeof(tc) == "undefined" || (i >= tc.length)) {
this.nextCase++;
this.nextTest = 0;
} else {
dw("subviews[", v, "].run(", this.result, ", ", tc[i], ");");
this.onteststart.sendEvent(tc[i]);
subviews[v].run(this.result, tc[i]);
this.ontestfinish.sendEvent([tc[i],this.result.numFailures() > 0 ? 'fail' : 'pass']);
}
var c = new LzDelegate( this , "runNextTest" )
LzIdle.callOnIdle(c);
// This fix papers over a difference between swf and dhtml, and I'm not sure
// why this fixes it. In dhtml, without this change, the control panel
// becomes invisible when the tests fail, but in swf, we don't see that problem.
// in any case, this fixes bug LPP-4109 [bshine 2007.06.29]
this.controlPanel.bringToFront(); // make sure we can see the control panel
return true;
]]>
tests.append(theTest);