Katalon Analytics (beta) – Bringing new insights into test reports. Learn more!

How to count mobile objects?


I would like to know how to count mobile objects. For example: I have a list, and I want to count the number of items within the list.

Thank you very much!


  • Hi there,

    Counting the number of items within a list is easy:


    => Count all items in the list


    => Count specific items in the list

    def list = [0, 1, 2, 1, 1, 3, 2, 0, 1]

    assert 9 == list.size()
    assert 2 == list.count(0)
    assert 4 == list.count(1)
    assert 2 == list.count(2)
    assert 1 == list.count(3)
  • For further actions to list, you should refer to Groovy Documentations here. They have all the information you need to do with the list.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion