SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Dec 2000
    Location
    Bannockburn, IL
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaApplet class - can\'t get public methods

    Hello,

    I'm testing a jsp application which runs an applet in a frame of the browser. The class name is Control.class and it is built on the Applet java class.

    Here is the problem...

    A developer wrote some methods in this class for my testing purposes that would pass values to 4Test. I cannot access these methods because I cannot record the actual class. It is recognized as a predefined JavaApplet class.

    I've read about commenting out the JavaApplet class entry in the Javaex.inc file and rerecording the class.....that did not work.

    Is there a way to call these methods since I know that they are there, without having declared them in the winclass?

    Also, when I do a "CaptureAllClasses" on the applet, it gives me all the custom stuff in the applet but not the applet (class file) itself.

    Any thoughts?


    ------------------

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JavaApplet class - can\'t get public methods

    You're using Record/Classes with "Show all classes" checked, right?

    1. To get around the "predefined classes" issue, just rename the newly-recorded class in the "Class Name" field. For example, call it MyJavaApplet". Paste the results into your file.

    2. Apply that new class name - "MyJavaApplet" - to the declaration for your instance.

    3. Include the function prototype for invokeMethod into the MyJavaApplet class.

    4. Use invokeMethod to call whatever method you desire from those listed in the recorded class.


    John

    ------------------


    [This message has been edited by John J. Miller (edited 09-18-2002).]

  3. #3
    Member
    Join Date
    Dec 2000
    Location
    Bannockburn, IL
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JavaApplet class - can\'t get public methods

    Hi John,

    I'm not too sure how willing dev will be to include testing code in the product. I will find out. But before I do that, the problem is that I cannot record the class because it is not exposed and I cannot mouse over it. Confusing? Sorry...let me explain. There are many custom panels within this frame and anywhere you mouse over, you get the nested custom panel in the record class window.

    I called CaptureAllClasses and pointed it to the BrowserPage.AppletInQuestion and it returns all the custom stuff and their methods. Just not the top level class, which does all the logic for the custom presentation stuff. Even when I call CaptureObjectClass on the Applet, it returns only a tag of "[JavaApplet]" with no methods. I'm sure it's an application architecture issue, just not sure how I can get around it.

    I can explain further if you have any ideas.

    Thank you,

    geliopou



    ------------------

  4. #4
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JavaApplet class - can\'t get public methods

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by geliopou:

    I'm not too sure how willing dev will be to include testing code in the product.
    <HR></BLOCKQUOTE>

    Dont worry, no product code is affected.

    Record/Classes and its 4Test equivalent CaptureAllClasses() only expose the public methods and properties of a specified object. The outputs of both commands are virtually identical.

    Record/Classes is easier to use because you can just point the mouse at the object. CaptureAllClasses is a bit more difficult because the tag to the intended object must be accurate. (And I believe that you must have both Record/Classes checkboxes, checked.) Defining the tag is relatively easy IF you have access to the object.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
    I called CaptureAllClasses and pointed it to the BrowserPage.AppletInQuestion and it returns all the custom stuff and their methods.
    [QUOTE]


    ? Can you then successfully call AppletInQuestions' methods using invokeMethods?

    [QUOTE]
    Just not the top level class, which does all the logic for the custom presentation stuff.
    <HR></BLOCKQUOTE>

    Hmmm...do you actually want access to its presentation methods? Are you trying to perform some amount of unit testing as opposed to testing what a real-user would be able to do?

    Realize too, that you don't necessarily need explicit declarations of any 'parent' containers because their tags can be appended to the tags of their 'child' objects.


    John




    ------------------

  5. #5
    Member
    Join Date
    Dec 2000
    Location
    Bannockburn, IL
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JavaApplet class - can\'t get public methods

    Hi John,

    Please visit the following link for a snapshot of the applet and the page declaration for it. Maybe that will clear a little up.
    http://www.straightpool.com/qa

    The snapshot of the applet is appears exactly how it does in the application. If you notice, there is a popup that is invoked by right clicking on an item in the control panel. Herein lies the problem. The methods that I am trying to access, return the RECT of any item requested. That will in turn be used by Silk to click appropriately.

    Thank you,

    geliopoulos@yahoo.com

    ------------------

  6. #6
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JavaApplet class - can\'t get public methods

    1. In re-reviewing the initial post and your recent link's contents, I believe that invokeJava() will work much better for your purposes than InvokeMethods.

    InvokeMethods expects that a recognizable and addressible object exists. InvokeJava doesn't need one since it uses the class constructor to obtain information for Silk.

    Take a look at "InvokeJava method" in the online help index for implementation details.

    InvokeJava is a bit unusual in that you pass name of the class to be called and not an the name of an actual method. The result is that the class constructor is executed which creates a temporary instance. Inside that constructor is where you place Silk interface methods (from Silk's Qapjava class) and actual Java code to return the information you need.

    An example for your application might be:

    list of GetRectRecords lrRec =
    [your window].InvokeMethods("Control.class",{})


    2. On a related note there are a very high number of CustomWins in your declarations. Most of them could be completely ignored or at least converted into normal Silk-recognizable classes. To see how to do this look at the online help index for "ignored classes".


    John


    ------------------

  7. #7
    Member
    Join Date
    Dec 2000
    Location
    Bannockburn, IL
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JavaApplet class - can\'t get public methods

    Thanks John,

    I really appreciate all of your time.

    InvokeJava may be the next avenue I pursue. Not too sure how willing dev will be to cooperate.

    As for the customwins, the file I posted was the non-mapped declaration. I indeed have mapped all my customwins and ignored necessary ones. I have experienced some strange Silk behavior when doing this. After ignoring a class in the javaex.ini file, the first time you fire up Silk and do a "record identifier", the class is ignored. When you close that window and do another "record identifier", the class shows up again. This is happening in Silk 5.5 SP3.

    Any Chicago area consultants you may recommend?

    Thanks,

    geliopou

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:58 AM.

Copyright BetaSoft Inc.