What is the use of exception handling in Silk Test? how to use the commands?

Showing Answers 1 - 14 of 14 Answers

Sheebha

  • Aug 21st, 2006
 

If a testcase fails during the test execution (for ex, if the expected value doesn't match the actual value in the verification statement), SilkTest by default calls its built-in recovery system, which:

> Terminates the testcase

> Logs the error in the results file

> Restores your application to its default base state in preparation for te next test case.

Commands:

Using do...except

do

  

  Was this answer useful?  Yes

sheebha

  • Aug 21st, 2006
 

Commands: do command

do

exception raised here

except

statements

....

control passes

....

Example:

testcase except1(STRING sExpectedVal, STRING sActualVal)

do

Verify(sExpectedVal,sActualVal)

Print("Verification succeeded")

except

Print("Verification Failed")

Raise Command

In addition to use buil-in exceptions, you can define your own exceptions and generate them using the raise statement

Reraise Command

You can also use do...except to perform some custom error handling, then use the reraise statement to pass control to te recovery system as usual

  Was this answer useful?  Yes

Naresh J

  • Dec 28th, 2006
 

Hi,

When ever you execute any Testcase in Automation 2 things are always mandatory.

  1. Prevalidation or verification for the exsisting Window/browser.
  2. Post validation or verification of Next Window/Browser.

Now during execution any other window/ browser is poping up etc, then those are called exception's, and that needs ur attention.

And that can be handled by DO EXCEPT method as said by Sheebha.

Well coming to what happends when a exception occurs WITHOUT a do except method, is clearly explained by Sheebha. But it applies only for Default base state not for the Rest. Also it does not apply when u run in suit file.

Regards

Naresh J

  Was this answer useful?  Yes

test12geeta

  • Apr 21st, 2009
 

Suppose there is a testcase which has 3-verification functions in each verification function there is Do Except error handling statement.
In this case if first verification function fails, it will log the result to result file. the rest two verification functions will execute without aborting the test case.
so once the test case executes completely, user can see the result file and come to the conclusion which verification function got failed.
This is one use of exception handling.

As the name suggests, exception handling is used to handle any unexpected result.

During the execution of a test case, if the application do not behave as expected and the script gets an error, the build-in recovery system terminates the particular test case, close the current open all windows/browsers and navigate to the default base state of the application.

  Was this answer useful?  Yes

Silk test support In the following built exception function:
ExceptCalls ( )
ExceptClear ( )
ExceptData ( )
ExceptLog function
ExceptPrint function
We have write code the like that do raise 1, "My error" except Print (ExceptData ())

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions