Mailing list - Entries of 2005


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

Re: [qftestJUI] Can qftestJUI be used under this situation?


  • Subject: Re: [qftestJUI] Can qftestJUI be used under this situation?
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: Sun, 15 May 2005 16:22:02 -0000

Hi Kevin,

the answer is yes to all of your questions.

Jython is based on Java and gives access to the full Java API.

After

canvas = rc.getComponent("qftest id of Canvas")

canvas is the actual Canvas object (or rather the object of your
derived class). You can call all of its public methods (and the
non-public ones with a bit of hacking), both from the Canvas API and
your derived class API exactly as when using Java.

You can import and access static classes from the SUT or from
additional jar files placed in the plugin directory, e.g.

from java.lang import System

print "system props: ", System.getProperties()

Best regards,
    Greg


Kevin Duffey <supreme_java_guru_1@?.com> writes:

> Gregor,
>
> Thank you very much for the reply. I just want to be
> sure I understand... can the jython script actually
> access the JPanel (or other JComponent) object?
> Actually, a better question is, can jython be used to
> access any of our internal API's, for example, can I
> write a script that accesses a class with some static
> methods that is not part of the canvas itself?
>
> The big question, not sure I asked this right, but for
> those areas that can only be recorded via
> absolute/relative positions, is there any way to write
> java code that can be executed as part of the script,
> such that I can have a library of java coded
> procedures (methods?) and insert them into the script
> at certain points. The way I would like to see this
> work is that I can record the normal stuff, menus,
> dialogs, etc. Then, at the point where I need to
> automate the canvas, I can call to a java coded
> routine that can directly access any of the code being
> tested (anything public that is). Is this possible, if
> so, how?
>
> Thanks.
>
>
> --- Gregor Schmid <Gregor.Schmid@?.de> wrote:
> >
> > Hi Kevin,
> >
> > such things cannot be captured directly because
> > qftestJUI doesn't have
> > any idea what's shown in the canvas, but you can
> > easily use Jython to
> > achieve what you want.
> >
> > Let's say your canvas has a method called
> > getLocation(String objectID)
> > that retrieves the position of some graphic item.
> > You can the create a
> > procedure in qftestJUI that simulates a click on
> > such an item as
> > follows:
> >
> > First record a single mouse click on the canvas so
> > the canvas
> > component gets recorded. Let's assume the component
> > id is "Canvas".
> > Change the X/Y coordinates of the MPRC node to
> > $(ix), $(iy) and move
> > the node inside a newly created procedure as shown
> > below.
> >
> >
> > + Procedure clickItem
> >   (Parameters objectID, x, y where x and y will be
> > relative to item,
> >    1,1 are good defaults for x,y)
> >   + SUT script [see below]
> >   + MPRC ($(ix), $(iy)) on Canvas
> >
> >
> > The SUT script needs to offset the given x/y
> > coordinate to the
> > position of the item:
> >
> > # get hold of the actual canvas object
> > canvas = rc.getComponent("Canvas")
> > # determine item location
> > pos = canvas.getLocation(rc.lookup("objectID"))
> > # store target position in ix/iy
> > rc.setLocal("ix", $(x) + pos.x)
> > rc.setLocal("iy", $(y) + pos.y)
> >
> >
> > That's all there is to it. That generic procedure
> > can be used whenever
> > you need to click on an item in your canvas.
> >
> > For details about the script, see the API reference
> > and the scripting
> > chapter in the user manual.
> >
> > Best regards,
> >     Greg
> >
> > Kevin Duffey <supreme_java_guru_1@?.com> writes:
> >
> > > Hi everyone,
> > >
> > > We are looking to see if there is any way we can
> > run
> > > custom java code to access our internal APIs of
> > our
> > > application as part of the record/playback
> > process.
> > > The problem is, 2/3 of our application is a huge
> > > canvas that we paint on with our own simulated
> > painted
> > > components. Is there any way to record/playback
> > this
> > > without resorting to relative x,y locations? We
> > don't
> > > want things like the size of the painted
> > components,
> > > the size of the window, colors (if image
> > comparisons
> > > are being done) and so forth to be a problem.
> > >
> > > The only way we can see this being useful is if we
> > can
> > > use parts of our internal model that the canvas
> > uses
> > > to render itself with, so that we can get the
> > objects
> > > we are painting, figure out where they are
> > painted,
> > > etc.
> > >
> > > Thanks.
> >
> > --
> > 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
> >
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

--
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 Documentation Buy Free Trial