Search code examples
rft

Iterate the test object map


Is it possible to iterate the test object map within RFT? I have several (imported) object maps, and would like as well as a list of TestObjects - I would like to be able to look for the existence of the test object in a given map. Is this possible?


Solution

  • You can use getMap() to get the object map, then use elements() to get an Enumeration you can iterate over:

    Enumeration mappedObjects = getMap().elements();
    while (mappedObjects.hasMoreElements()) {
        mappedObjects.nextElement(); // do something with it...
    }
    

    If you have the test object name, you can also use getMappedTestObject(objName) to get an object directly from the map. It throws an ObjectNotInMapException when the object is not in the map.