scrier
13 years agoContributor
Can't catch exceptions from extensions.
Hello,
I have the following issue (somewhat simplified):
I have an extension in javascript that evaluates parameters in and if necessary throws an exception. Problem is that if the extension script throws the exception, TestComplete cannot catch it. Here is a simple test showing the issue:
extension.js:
function testThrow()
{
throw new CustomException("Catch!!!");
}
function CustomException(text)
{
this.name="CustomException";
this.message=text;
}
description.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ScriptExtensionGroup>
<ScriptExtension Name ="Test Object" Author="me" Version="0.1" HomePage="None">
<Script Name ="extension.js">
<RuntimeObject Name="Tests" Namespace="TEST">
<Method Name="testThrow" Routine="testThrow">
</Method>
</RuntimeObject>
</Script>
</ScriptExtension>
</ScriptExtensionGroup>
testfunction in testcomplete:
function TestThrow()
{
try {
TEST.Tests.testThrow();
} catch(ex) {
Log.Message(ex.name + ": " + ex.message);
}
}
I get the screenshot as listed below and it works if I throw in testcomplete, but not between extension and testcomplete.
// Andreas
I have the following issue (somewhat simplified):
I have an extension in javascript that evaluates parameters in and if necessary throws an exception. Problem is that if the extension script throws the exception, TestComplete cannot catch it. Here is a simple test showing the issue:
extension.js:
function testThrow()
{
throw new CustomException("Catch!!!");
}
function CustomException(text)
{
this.name="CustomException";
this.message=text;
}
description.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ScriptExtensionGroup>
<ScriptExtension Name ="Test Object" Author="me" Version="0.1" HomePage="None">
<Script Name ="extension.js">
<RuntimeObject Name="Tests" Namespace="TEST">
<Method Name="testThrow" Routine="testThrow">
</Method>
</RuntimeObject>
</Script>
</ScriptExtension>
</ScriptExtensionGroup>
testfunction in testcomplete:
function TestThrow()
{
try {
TEST.Tests.testThrow();
} catch(ex) {
Log.Message(ex.name + ": " + ex.message);
}
}
I get the screenshot as listed below and it works if I throw in testcomplete, but not between extension and testcomplete.
// Andreas