Forum Discussion

Anusha's avatar
Anusha
New Contributor
13 years ago

Validate DevExpress comboBox with TestComplete

Hi,



   I have a DevExpress comboBox , and i want to know how to validate comboBox items using TestComplete(since i have a list of items in my comboBox i know that i should use object Checkpoint). In one test i want to see if all the required items in comboBox are present.

How to do so ?







Thanks in advance,

Anusha
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Anusha,


    I used the following code for this purpose:




    Sub Test1

     Dim ReqValues(3)

     

     ReqValues(0) = "Item1"

     ReqValues(1) = "Item2"

     ReqValues(2) = "Item3"

     

     Set Control =  <DX_ComboBox_Object>

     Num = Control.wItemCount

     k = 0

     

     For i = 0 to Num - 1

       Item = Control.wItem(i)

       For j = 0 to 2

        If ReqValues(j) = Item Then

          k = k + 1

        End If

       Next

     Next

     

     If k = 3 Then    ' <- Here, 3 is the size of the ReqValues array

      Log.Message("The combo box contains all the required values")

     Else

      Log.Message("The combo box doesn't contain all the required values")

     End If



    End Sub


    Maybe there is a simpler approach, but I don't know it.


    I hope this helps :)

  • Anusha's avatar
    Anusha
    New Contributor
    Hi Irina,



        Thank you for your reply :) . I just want to know if i can do it through design using checkpoints ?.



     I have a clarification also regarding object checkpoint. Lets take a combobox items for example, using object checkpoint can i validate a single comboBox items's properties like visible,enable etc through object checkpoint or can i validate all the items in the comboBox assuming all the items in comboBox as different objects ?

     





    Thanks and Regards,

    Anusha T
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Anusha,


    I just want to know if i can do it through design using checkpoints?


    Yes, you can do it using either the Object or Property checkpoints. The difference is that using Property checkpoints, you can verify the value of a single property, and the Object checkpoints let you verify the values of several properties.


    As for checking the values of specific item's properties, I'm not sure whether it's possible. I've tried specifying the combo box item as an object for the Object checkpoint and I failed to do this (maybe it's not treated as object).


    So, if you need to verify the item's value and other properties, I'd better use the Property checkpoint.