TestComplete allows committing various types of messages to the log: ordinary messages, warnings, logs, and so on.
In this recipe, we will consider examples of how to use these messages.
In order to see examples of all the message types in the log, the following steps should be performed:
function testMessages() { Log.Event("An event", "Event additional Info"); Log.Message("A message", "Message additional Info"); Log.Warning("A warning", "Warning additional Info"); Log.Error("An error", "Error additional Info"); Log.File("C:\somefile.txt", "A file posted to the log"); Log.Link("C:\somefile.txt", "A link to a file"); Log.Link("http://smartbear.com/", "HTTP link"); Log.Link("ftp://smartbear.com/", "FTP link"); }
In the result, we will get the following screenshot of the log:
In the given example, we have used four different types of messages. They are as follows:
These four types of message are based on several parameters. The first of them is a string that we observe in the log itself; the second one contains additional information which can be seen in the Additional Info tab, if the message has been clicked on. The second parameter is optional and can be omitted as well as all other parameters.
There are two more types of messages:
These two types of message accept the link as the first parameter, and then the message parameters, and those pertaining to the additional information (as the previous four). Only the first parameter is mandatory.
18.216.171.107