Negative Testing

Negative testing is testing in which test methods are designed to throw exceptions. Such methods should only be considered successful when a specific anticipated exception type is thrown.

Silk Performer offers an attribute that can be applied to test methods to indicate that a specific exception type is expected. If the specified exception is not thrown during execution, then the test method has failed.

Attribute Class Applicable to Parameters Descriptions
TestException method

- Exception type

- Log text if the anticipated exception is not thrown (optional)

Test method/transactions can be declared with one or more TestException attributes. During execution, the runtime checks to see if the defined exception type was thrown. If the anticipated exception type was thrown, then the method call is considered successful. If not, the method call is considered a failure and exception details are written to the log file.