0

In IBM Rational Functional Tester, I want to know if a TestObject has been perfectly matched.

The class TestObject has a method exists(), unfortunately it is useless, since it usually returns multiple matches when the desired object does not match.

Now, I'm trying to find the object and catching the com.rational.test.ft.AmbiguosRecognitionException, but it is ugly.

I'd like to test for the sole existence of an object, maybe just get the number of matched objects. Is there an API method that I'm overlooking?

Machavity
  • 30,841
  • 27
  • 92
  • 100
neves
  • 33,186
  • 27
  • 159
  • 192

2 Answers2

1

Try tweaking the recognition scoring (ScriptAssure under Window>pref>FunctionalTest>Playback) to make it stricter and see if that helps. This method as you have noticed will return true even if there are multiple matches .You could use the find() api( as suggested by @Roland) if you are dealing with case where there could be multiple matches found based on the object map recognition properties.

Prakash
  • 742
  • 7
  • 19
0

Normaly, the TestObject.find() method should give you an Array of matching test objects without throwing an AmbiguosRecognitionException, e.g.

TestObject[] matches = document_google().find(atDescendant(".type", "submit"));
matches.length; // no. of matching objects found (3 in this case)

Of course the object where you start the search (in the example above the document document_google() needs to be unique.

More on the find method on IBM developerWorks.

Roland
  • 1,220
  • 1
  • 14
  • 29
  • This way it doesn't work for me. The problem is that the object is already created in the object map. I When I call something like: html_list_options().find(), it returns not a list, but just a TestObject pointer. If it matches more than one object, it throws an exception. The problem is that I have more than one pull down menu and the desired object isn't present, it badly matches the other pull down menus of the page. – neves Nov 24 '15 at 15:11