Forum Discussion
Hello Joachim,
the problem is that I do not know how to refer to these pictures
Please note that you cannot refer to the pictures to be posted by a checkpoint message via LogParams or with any other object. TestComplete does not provide such functionality.
To post the pictures with the Picture parameter of the Log.Warning method, or with the Log.Picture method from your event handler, you should refer to those pictures in the same way as you refer to them when calling the Region Checkpoint or Compare Pictures operation, or the Region.Check, Regions.Compare or Picture.Compare method in your tests.
Isnt't it possible to make the picture-tab (and additional information) of the warning look the same as in the "normal" error event with all the functionality like diff-view, zoom,...?
TestComplete does not allow posting actual and expected images to the Picture panel manually.
As a workaround, you can follow the steps below:
1. Use the Picture.Compare method or the Compare Pictures operation for region checkpoints. Both the method and the operation have the MessageType parameter that allows specifying the type of the message (error, warning, etc.) to be posted if the comparison fails.
2. When calling the Picture.Compare method or the Compare Pictures operation in your tests, set the MessageType parameter value according to the type of the message you want to post to the log.
3. Modify your OnLogError event handler in the following way:
function GeneralEvents_OnLogError(Sender, LogParams)
{
PostedByCheckpoint = false;
MyIssue = ProjectSuite.Variables.issueId;
if (aqString.Find(LogParams.Str, "The images are not equal") >= 0)
PostedByCheckpoint = true;
if ((MyIssue == -1) && (PostedByCheckpoint))
LogParams.Str = "New bug: the region checkpoint failed.";
}
4. Create the following event handler for the OnLogWarning event:
function GeneralEvents_OnLogWarning(Sender, LogParams)
{
PostedByCheckpoint = false;
MyIssue = ProjectSuite.Variables.issueId;
if (aqString.Find(LogParams.Str, "The images are not equal") >= 0)
PostedByCheckpoint = true;
if ((MyIssue != -1) && (PostedByCheckpoint))
{
LogParams.Str = "Known bug (issueID = " + MyIssue + "): the region checkpoint failed.";
ProjectSuite.Variables.issueID = -1;
}
}
Please let us know whether this workaround helps, or whether you have any additional questions.
Thank you.