Forum Discussion

rlent's avatar
rlent
Contributor
10 years ago

Can Test Complete 11 detect if a string is cut off?

I'd like to convince my superiors to purchase Test Complete 11. We use it for testing desktop applications. One thing that would really be useful is detecting if a string is cut off, like if the value for the object is "This is a test" but there is only room for "This is a te".

 

I know TC can check the value of an object and compare that against an expected value, but what would be really useful is if it could compare what is actually displayed agaisnt the expected value. It would eliminate a lot of tedious testing, especially when testing in foreign languages where it might not be as obvious when a string is cut off.

  • I did figure this out.

     

     Log.Message T1.WndCaption
     Set OCRObjWord = OCR.CreateObject(T1)
     Set OCROptionsWord = OCRObjWord.CreateOptions
     
      ' Add font to the Options object.
      Set FontItem = OCROptionsWord.Fonts.Add
     
      ' Specify the font name.
      FontItem.Name = "Arial"
     
      ' Add the font size.
      Call FontItem.Sizes.Add(10)
     
      ' Add the bold style.
      Call FontItem.Styles.Add(1)
     
      ' Call the GetText function with the specified options.
      Call Log.Message("Recognized word: " + OCRObjWord.GetText(OCROptionsWord))

     

    I can use the OCR to look at what is actually displayed and compare that to the field value is. If what is displayed is shorter, then the string is cut off.

  • I would expect that what is actually displayed is an object property of some sort, and that's compared in the same way as the example you gave.  What we frequently do is enter a value in a field from some variable and then fetch the value from the field directly to log it or compare it.  

  • NisHera's avatar
    NisHera
    Valued Contributor

    it is possible
    My advice is just take evaluation licence and work for a 30 days and see your self.
    Other things you may hv to consider is builing good testing framework is time and effert consuming
    so should not give too much expectations to superiors.
    There is a leaning curve specially if do not have programming background.
    Once you pass that leaning curve, it's much efffective and easy.

  • I did figure this out.

     

     Log.Message T1.WndCaption
     Set OCRObjWord = OCR.CreateObject(T1)
     Set OCROptionsWord = OCRObjWord.CreateOptions
     
      ' Add font to the Options object.
      Set FontItem = OCROptionsWord.Fonts.Add
     
      ' Specify the font name.
      FontItem.Name = "Arial"
     
      ' Add the font size.
      Call FontItem.Sizes.Add(10)
     
      ' Add the bold style.
      Call FontItem.Styles.Add(1)
     
      ' Call the GetText function with the specified options.
      Call Log.Message("Recognized word: " + OCRObjWord.GetText(OCROptionsWord))

     

    I can use the OCR to look at what is actually displayed and compare that to the field value is. If what is displayed is shorter, then the string is cut off.