Forum Discussion

Ivg's avatar
Ivg
Occasional Contributor
8 years ago

How to see a native method's signature in UI Spy

Hi,

 

I can't see the signature of native methods in UI Spy (the methods that are accessible through the IObject interface).

 

I'm testing Java Swing app, not sure how it will behave on .NET objects.

 

Is it supported in TestLeft?

 

As I remember it is supported in TestComplete.

 

Thanks

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Ivg,

     

    Regarding the missing native method signatures, please contact support to see if this is an error or intentional. As a workaround you can:

    • Look up the method signatures in the Java API docs (for standard Java classes).
    • Use JD-GUI (a Java decompiler) to inspect the classes and methods in your tested app.

     

    Regarding the actual method calls:

     

    If the method parameters and return value are of primitive types such as strings/integers/booleans, TestLeft will take care of converting the data types. For example:

    // Calling JTextField.getText(), .setText(string)

    string text = textField.CallMethod<string>("getText"); textField.CallMethod("setText", new object[] { "Hello from TestLeft!" });

    If a method returns an object, you can cast the result to IObject and use GetProperty/CallMethod to access the object members:

    // Reading Rectangle.width

    IObject bounds = obj.CallMethod<IObject>("getBounds"); int width = result.GetProperty<int>("width");

    I'm not sure if passing objects into Java methods is supported though, you'll have to check with support about that.

    UPD: Passing native objects as parameters to native methods is supported since TestLeft 2.3.