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 18:40:50 +0200

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
> _______________________________________________
> qftestJUI-list mailing list
> qftestJUI-list@?.de
> http://www.qfs.de/mailman/listinfo/qftestjui-list

-- 
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