Forum Discussion

sujatha_babu's avatar
sujatha_babu
Contributor
11 years ago
Solved

Getting Error message - when Region checkpoint is created

Hi,



I am using Test Complete 9.30,  when I give the region name while creating the Region checkpoints in the recording process, I am getting an error message.

 

Please check the screen shot.

 

Note: We use numeric values for region name.



  • Hi,



    I believe Support will comment this, but I see no big problem with adding some prefix to numerical name of the checkpoint to keep case ids numerical on the one hand and conform to the naming requirements in TC on the other hand.

8 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi,



    As the checkpoint name can be a part of the test code, it must follow the requirements for the variable names for the given scripting language. In your case - it must not start from the digit.
  • Hi,



    But in Test Complete 8.0, we were using digit for region checkpoints. we use Test case Ids for corresponding Region checkpoints. is it there is any other options to use digit for region check points?
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi,



    I believe Support will comment this, but I see no big problem with adding some prefix to numerical name of the checkpoint to keep case ids numerical on the one hand and conform to the naming requirements in TC on the other hand.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    As far as I remember, it was changed for a reason. Now, it's possible to compare the images in the following way:


    Regions.image_name.Check


    This is why checkpoint names should meet the naming rules for variables: it's impossible to start a variable name with a digit.


     

  • Hi,



    I have one more issue regarding Region checkpoints. I am using script view for my testing purpose, when I create the region checkpoints using the "Select Window region" (by mouse drag) it generates the following code. When I use this code in my script, am unable to do the image comparison. Getting an error as "Cannot get a picture object from the input parameter"




    // generated code:



    function Test2()

    {

      Regions["IR17430"]["Check"](Regions["CreateRegionInfo"](Sys["Process"]("17430")["WPFObject"]("HwndSource: window1")["WPFObject"]("window1"), 39, 105, 956, 584, false));

      LLCollection1["LLP1_17430"]["Execute"](Sys["Process"]("17430")["WPFObject"]("HwndSource: window1")["WPFObject"]("window1"));

    }



    // my script:


    LLCollection1["LLP1_17430"]["Execute"](Sys["Process"]("17430")["WPFObject"]("HwndSource: window1")["WPFObject"]("window1")["WPFObject"]("Chart1")["WPFObject"]("Area1"));

        BuiltIn["Delay"](1500);

        var ImgPros =(Sys["Process"]("17430")["WPFObject"]("HwndSource: window1")["WPFObject"]("window1")["WPFObject"]("Chart1")["WPFObject"]("Area1"));           

        AddImage(ImgPros,"IR17430")

        if(!Regions["Compare"](ImgPros,"IR17430", false, false, true, 0))

          Failure ("DI_17430_0_WPF_Chart_Chart", ImgPros, DefectInfo)
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Sujatha,


     


    In which line are you getting this error?


    BTW, I noticed that TestComplete recorded the actions with the Sys["Process"]("17430")["WPFObject"]("HwndSource: window1")["WPFObject"]("window1") object. However, you are using the following object in your script:



    Sys["Process"]("17430")["WPFObject"]("HwndSource: window1")["WPFObject"]("window1")["WPFObject"]("Chart1")["WPFObject"]("Area1")

     


    This might be the reason for the test's failure.


     

  • Hi Tanya,



    I am getting an error in the following line and  in the log i am getting an error as "Cannot get a picture object from the input parameter"



    //code snippet



     if(!Regions["Compare"](ImgPros,"IR17430", false, false, true, 0))
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Sujatha,


     


    Try using the following modified line:


    if(!Regions["Compare"](ImgPros.Picture(),"IR17430"))


     


    If this doesn't work, please make sure that you are using the latest TestComplete version - v. 9.31.