LogError Function

Action

Logs an error message to the results file.

Syntax

LogError (sMsg, [cmd-line])
Variable Description
sMsg The text to write to the results file, typically an error message. STRING.
cmd-line Optional: An expression that contains a command line. If specified, the results file displays an icon on the error line. When you click the icon, the command line executes. STRING.

Notes

LogError writes a string, usually in form of an error message, to the results file. The string, which is created by the LogError function, is marked internally as an error line. This causes the line to display in the results file in red or italics, depending on the platform. The number of errors logged by LogError is also stored in the results file.

Silk Test Classic calls LogError automatically when it raises an exception that you have not handled. Your exception handlers should also call it if you want your error messages to be flagged as real errors in the results file. LogError does not halt the execution of scripts or test cases.

GetTestsFailedCount does not count user-defined errors when using LogError().

Example

LogError ("*** Error: Expected Message Box did not appear")