Forum Discussion

jsc's avatar
jsc
Regular Contributor
15 years ago

Adding strings or variables to each checkpoint

Hi all,



is there a possibility to add variables and / or strings to a specific (region) checkpoint, that are displayed if a checkpoint fails?

And can these strings or variables be accessed via jscript.



example: (checkpoint (CP) 1 & 2 are known bugs, CP3 is a new bug)



current behaviour:

- CP1: "the regions are not equal."

- CP2: "the regions are not equal."

- CP3: "the regions are not equal."



Wanted behaviour:

- CP1: "the regions are not equal. Know bug, issue ID = 123"

- CP2: "the regions are not equal. Know bug, issue ID = 239"

- CP3: "the regions are not equal."



I wanted to see directly which failed checkpoints are already known bugs and which fail for the first time.



If there is a different solution to my problem, I would appreciate suggestions.



Kind regards,



Joachim

15 Replies

  • Hello Joachim,


    I am still not able to append the pictures that would be attached to the error (expected image & actual image) to this warning.


    To post an image to the log, please use the Picture property of the Log.Warning method. The property specifies the image to be posted with the message.

    However, you can post only one image in this way. Since you need to post two images (actual and expected), you can post them by calling the Log.Picture method for each image before (or right after) posting the warning.


    I hope you will find this information helpful.

    Thank you.

  • jsc's avatar
    jsc
    Regular Contributor
    Hi Julia,



    the problem is that I do not know how to refer to these pictures (as they have been taken already, otherwise there would be no error event!).



    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,...?

    All the information should already be known within this event! But how can I access them?



    Kind regards,



    Joachim
  • 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.

  • jsc's avatar
    jsc
    Regular Contributor
    Hi Julia,



    thanks for your reply.



    Hm, this workaround is nothing that I am gonna use as a want to have this nice functionality of the regular checkpoint-output and I need the waitfortimeout functionality of region checkpoints that compare picture checkpoints do not have.



    Why is there no option to change the log-parameter of region checkpoints from error to warning (and maybe just to message)?

    This would (in my opinion) be a quite useful feature, that many could use.



    I then think about other ways to achive distinction of known bugs and
    new bugs. But this would have been a quite easy and nice way.



    Kind regards,



    Joachim
  • Hello Joachim,


    Sorry to hear that the suggested workaround was not useful for you.

    Currently, TestComplete does not seem to provide any functionality that suits your needs. Could you please use this Contact Support form and send your suggestions to improve the checkpoints functionality to our Support Team (when submitting the form, please select Product improvement idea in the Type of Request drop-down list)? Your suggestions will be registered in our database.

    Thanks in advance.