Mailingliste - Einträge 2006


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qftestJUI] Jython Itegration Question


  • Subject: Re: [qftestJUI] Jython Itegration Question
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 25 Jul 2006 21:43:09 +0200

[I'm CC-ing the list again as we're still covering interesting ground]

Hi Tim,

if Jython cannot import your class it usually means that it's not
among those accessible from the system class path but loaded through a
special class loader (maybe simply WebStart, I don't know about that
out of my head but it's definitely using a special class loader as
well).

In that case the best approach is to get hold of the class loader
through an class of your SUT that's accessible by going through the
GUI. I.e. if you have some custom table you should be able to use

table = rc.getComponent(...)
loader = table.getClass().getClassLoader() 
Convenient = loader.loadClass("com.portware.Convenient")

Or use the table model or whatever you need to get to any custom class
from your SUT.

Best regards,
    Greg


TFrey@?.com writes:

>    Gregor,
>    Thank you for your timely and informative response.  I'm still having
>    some problems, though.  Accessing the TableModel through our custom
>    Table works well enough but my co-worker informs me that there is an
>    easier way to get at the data I need.  He says that there are some
>    static convenience methods in, let's say, com.portware.Convenient,
>    that will give me access to said data.
>    I tried to access this class by writing:
>    from com.portware import Convenient
>    But Jython says that there is no module named "portware."  If I write:
>    import com;
>    dir(com);
>    I can see some other packages (like com.sun, com.ibm) but not
>    com.portware.  Should Qf-Test have access to the packages that my
>    program resides in automatically or is there something that I need to
>    do first?
>    Thanks again,
>    Tim
> 
>    Gregor Schmid <Gregor.Schmid@?.de>
> 
>    07/25/2006 12:40 PM
> 
>                                                                        To
> 
>    qftestJUI-list@?.de
> 
>                                                                        cc
> 
>    TFrey@?.com
> 
>                                                                   Subject
> 
>    Re: [qftestJUI] Jython Itegration Question
> 
>    Hi Timothy,
>    interesting (and not infrequent) question.
>    You really can access any public (and even non-public) method of any
>    of your application's objects _if_ you can get hold of the object.
>    There are two ways to do this. One is to come from the GUI, using, for
>    example, table = rc.getComponent("...") to get hold of a JTable, then
>    table.getModel() to get the TableModel and go on from there.
>    If the object of interest is not (easily) reachable from a GUI
>    component, you can import classes of your SUT and create instances of
>    those classes or call their static methods, e.g.
>    from com.portware import SomeClass
>    someObject = SomeClass() # same as new SomeClass() in Java
>    someObject = SomeClass.getInstance() # in case of a singleton
>    If there is also no easy way to get what you want you will need to
>    create some singleton Object registry and modify your source code so
>    the object will register itself, then retrieve it from the registry
>    using Jython.
>    One more note:
>    You can experiment with these things using the client-side Jython
>    terminal available from the "Clients" menu. To work through the GUI,
>    first run an SUT script like
>    global table
>    table = rc.getComponent("...")
>    to make table globally accessible so you can use it in the terminal.
>    Hope that helps.
>    Best regards,
>       Greg
>    TFrey@?.com writes:
>    >    To Whom it May Concern,
>    >    My name is Timothy Frey and I am currently evaluating Qf-Test for
>    my
>    >    company, Portware LLC.  Lately I've been experimenting with the
>    Jython
>    >    integration that your product offers.  I noticed that on page 74
>    of
>    >    the User Manual, under the "Fundamentals of the Jython
>    Integeration"
>    >    heading, there is a passage that reads, "SUT scripts on the other
>    hand
>    >    give full access to the components of the SUT and to every Java
>    API
>    >    that the SUT exposes."  I have been able to write a test script
>    that
>    >    can access, for example, the label of one of my JButton
>    components.
>    >    However, I am more interested in the second part of said passage.
>    >    With an SUT script, do I have access to all of the APIs that my
>    >    program uses to run?  How do I access this functionality?
>    >    For example, if I have a class named 'com.portware.SomeClass'
>    which is
>    >    not a GUI component, can I write a script that can access this
>    class
>    >    and create objects of this type?  My overall goal is to test
>    whether
>    >    or not I can access the underlying data of some of our GUI
>    components,
>    >    specifically some data that our TableModels rely on.  Can you
>    offer
>    >    any insight or advice?
>    >    Thanks in advance,
>    >    Timothy Frey
>    >    Portware, LLC.
>    >    120 Broadway
>    >    New York, NY 10271
>    >    (212) 571-4660 x 2153

-- 
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876


Videos Downloads Dokumentation Kaufen Gratis Testen