Using Non-Component Locators: How a Locator Works


Non-Component Locators (NCLs) are objects of the nonComponentLocator class. This class contains two methods--findObject() and getNamedObjectData()--that you implement with code specific to the toolkit you are using.

This section describes:

Recording a Script with an NCL

Recording with a non-component locator

As you record a script, JavaStar monitors your interaction with the application under test. If you defined your test to use an NCL as you record, the test is recorded using the procedure:

  1. Test operator performs an event on a non-component.

  2. JavaStar monitors the event, noting the parent Component (the parent deriving from the JavaAWT library) and the AWTevent.

  3. JavaStar sends the Component and AWTevent to the NCL

  4. The NCL runs the data through its own acceptance criteria, and if it passes, it calls findObject(Component, AWTevent).

  5. findObject() identifies the non-component as an object of the toolkit, retrieves the location of the object, then determines how best to refer to this object using a String.

  6. The NCL returns the reference as part of a JSNCLData object.

  7. JavaStar takes the non-component reference supplied by the NCL and inserts this code into the test currently recording.

Running a Test with an NCL

Running a test with a non-component locator

  1. JavaStar receives an instruction from the test that references a non-component using a String.

  2. JavaStar calls the getNamedObjectData() method for the NCL. It passes the Component and the String referencing the non-component, as provided by the test code.

  3. getNamedObjectData() performs the reverse operation as findObject()--it uses the String passed in as an argument to determine the location (coordinates) of the object.

  4. getNamedObjectData() sends the location information back to JavaStar inside an NCLData object.

  5. JavaStar executes the event at the location specified.



Send feedback to JavaStar-feedback@suntest.com
Copyright © 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303. All rights reserved.