Combo field testing based on inputs from text file


Hi All,

I need a method to validate combo boxes based on the valid and invalid inputs from a text file.

I have to automate the testing of combo, where in the the combo lists only the supported valid options given as a input from a text file.

In the combo, i have to test for the following 2 scenarios:
1. The unsupported (invalid) options, given in the text file, should not appear in the combo list.
2. All the supported (valid) options, given in the text file, should appear in the combo list.
If the above 2 cases are not happening then the scenarios should fail.

I tried the image capturing method, but found that it'll work only for the options displayed in the combo. As the image can be captured only for the displayed options in the list.

Currently in my application, the combo does not display the invalid options in the list, but it does not list all the valid options also in it(only few valids are getting displayed). So i have to put not displaying all the valid options as an error with the scripts. Also, if unsupported option get displayed in future, i need to handle this and log that as an error.

What method i can use to test these scenarios correctly :!:

Comments

  • If you can select the text in this combo box you can validate the items through the clipboard. Once you have iterated over each item and have placed each item in the clipboard you should be able to construct a complete list of the items that are present. You can then use simple logic to determine if the set is valid or invalid.

    For text that is not selectable you might be able to use text image generation, introduced in Eggplant v3.0, to validate the combo box. The text image generation feature however, only works on OS X and Windows. With a little bit of effort however, you can implement your own text image generator. Consult the "Eggplant Reference" document for more information on text image generation.

    Text image generation is often useful in scenarios where you already have prior knowledge of the text that should be displayed on the remote interface. Since you already know what the valid items for the combo box should be, you can generate the text images from the data file provided that text image generation supports your application.

    Example data.txt
    apple
    cat
    dog
    // define region of combo box using images
    put imageLocation("bound1") into b1
    put imageLocation("bound2") into b2
    put (b1,b2) into someRect
    
    repeat for each item in file "/path/to/data.txt"
    
             // text: the text to be generated
             // textStyle: defines the text attributes 
             //           of the text; font, color, etc
             // textPlatform: the platform the Text 
             //            Image Generator is running on
             // someRect: a variable that defines the
             //            region of the combo box
             if imagefound(text:it, textStyle:someStyle, textPlatform:WindowsClassic, searchRectangle:someRect) then
                   put "Found"
             else
                   LogError "The text item was not found in the combo box"
             end if
    end repeat
    
    

    The example above serves as a rough outline of what could be done. Chances are, you will need to implement some additional logic to get certain items in your combo box to appear. This example also assumes that the items in your combo box appear in alphabetical order.

    Keep in mind that text images ARE images. The only difference between text image generation and traditional image capture is that text images allow you to dynamically create text images as opposed to having to manually capture them.

    Hope that sparks some ideas!
  • Hi,

    The combo in our application does not support selection of text from it. So i cannot implement the first method to validate through clipboard.

    Also, i observed the text image method is not working for our application. I tried and verified text image method with the Windows standard application, and it worked correctly for it. So, i believe i cannot use this method also for automating my application. :|

    Is there any other method available to perform the same. :?:

    Also, i'm not finding 'text image' in the 3.21 release of Eggplant :!: . Its mentioned in the Release notes of 3.21 that -
    "Properly disable the Text Image (Purple) and Use Image (Green and Purple) menu items as appropriate"
    Does it indicate its been removed from the tool in this release :| If so, then what is the other way around for it :?:
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Payal wrote:
    Also, i observed the text image method is not working for our application. I tried and verified text image method with the Windows standard application, and it worked correctly for it. So, i believe i cannot use this method also for automating my application. :|

    Is there any other method available to perform the same. :?:
    I think generated text images are the best option for your particular scenario. The trick with text images is to discover the correct text attributes (e.g. font name, size, and colors) for the element you are controlling. The chances are good that if you can determine these characteristics for the text in your combo box then you can define a ComboBox text style and the text image approach will work for you.
    Payal wrote:
    Also, i'm not finding 'text image' in the 3.21 release of Eggplant :!: . Its mentioned in the Release notes of 3.21 that -
    "Properly disable the Text Image (Purple) and Use Image (Green and Purple) menu items as appropriate"
    Does it indicate its been removed from the tool in this release :| If so, then what is the other way around for it :?:
    That item in the Release Notes only refers to disabling the "Text Image..." menu item on the Connection menu during times when it is not available (such as when there is no connection, or it is not in Capture Mode). The Text Image capability is still very much present in the Purple (professional) edition of Eggplant.
Sign In or Register to comment.