Accessing Native Methods of Oracle Forms

Applies to TestComplete 14.30, last modified on November 21, 2019

You can access individual objects of Oracle Forms, their internal properties and methods. The following sections describe how you can access these native properties and methods from your tests:

About Accessing Native Methods

TestComplete identifies individual GUI objects in Oracle Forms. You can automate testing operations on these objects (for example, simulating user actions, or checking an object’s state) by using special properties and methods that TestComplete provides for all onscreen objects and specially for Oracle Forms objects.

If these properties and methods are not enough for your testing needs, you can use native methods of Oracle Forms objects. These are the same methods that are available in the tested application’s source code as well as custom methods implemented by the application developers.

This way, you can simulate almost any operation in a tested Oracle Forms applet, even those operations that cannot be performed via the GUI.

TestComplete recognizes objects in Oracle Forms as Java objects and marks them in the Object Browser with the glyph. To view the native methods available to an object, switch the Object Browser or Object Spy to the Advanced view mode. You will be able to access private, protected and public methods and fields of Oracle Forms objects. The Object Browser shows native methods under the Java category.

Native Properties of an Oracle Forms Frame in Object Browser

Calling Native Object Methods

When testing Oracle Forms, you can call their object methods from your tests.

To call an object’s method from script code, you use the dot operator "." (in VBScript, JScript, Python and DelphiScript projects) or square bracket notation [" "] (in C++Script and C#Script projects) to specify the method name after the object name.

For example, in script code you can call the native select_2 method of a popup list as follows:

JavaScript, JScript

Aliases.jp2launcher.frame0.VPopList.select_2("item 1");

Python

Aliases.jp2launcher.frame0.VPopList.select_2('item 1')

VBScript

Call Aliases.jp2launcher.frame0.VPopList.select_2("item 1")

DelphiScript

Aliases.jp2launcher.frame0.VPopList.select_2('item 1');

C++Script, C#Script

Aliases["jp2launcher"]["frame0"]["VPopList"]["select_2"]("item 1");

In keyword tests, you can use the On-Screen Action operation to call an object’s native method. For more information, see Calling Object Methods.

Important Notes

  • In the Object Spy or Object Browser, native fields and methods of Oracle Forms objects are displayed only in the Advanced view mode.

  • If a native method (or field) has the same name as the test object method (or field) provided by TestComplete, the native method (field) can be accessed via the NativeJavaObject property. For example, you can access the native validate method in Oracle Forms as follows:

    Aliases.jp2launcher.frame0.NativeJavaObject.validate

  • TestComplete supports access to array objects. To address array items, it adds the Items and Length properties to the appropriate scripting object. Length specifies the array size and Items provides access to elements by their indexes (zero-based), for instance, javaArrObj.Items(2).

    TestComplete represents multi-dimensional arrays as arrays in which every item is also an array. For instance, if javaArrObj is an array that has three dimensions, you can access its elements in the following way:

    javaArrObj.Items(1).Items(2).Items(3)

  • If an object has overloaded methods (methods with the same name but with different parameters and they return value types), TestComplete adds indexes to method names to distinguish them. For example, GetMousePosition() and GetMousePosition_2(). To determine to which overloaded method a method name with an index corresponds, examine the method’s parameter list in the Object Spy, Object Browser or Code Completion.

  • The leading underscore ( _ ) in property and method names is replaced with the character z. For example, a property named _flag is accessed as zflag, a method named __reset() is accessed as z_reset(), and so on.

See Also

Testing Oracle Forms

Highlight search results