Mailingliste - Einträge 2006

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

Re: [qftestJUI] if-clauses with component status

  • Subject: Re: [qftestJUI] if-clauses with component status
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 06 Jun 2006 21:23:37 +0200

Hello Robert,

Try/Catch with "Wait for component" normally is the correct way to go

You can use Check nodes to test for various states of a component but
you'll also need to use Try/Catch for the decision on how to react,

- Try
  - Check enabled state ("Throw exception on failure" activated)
  - Nodes for positive case...
  - Catch CheckFailedException
    Nodes for negative case...

However, in your case it might be better to use a completely different
mechanism to get rid of the dialogs: Using an "SUT script" node you
can implement an event listener that will close the dialog as soon as
it pops up, so qftestJUI will practivally never see it (untested):

# Event listener that closes notification dialogs

from javax.swing import JDialog
from java.awt.event import AWTEventListener, WindowEvent
from java.awt import Toolkit, AWTEvent

class DialogListener(AWTEventListener):
    def eventDispatched(self, event):
        com = event.getSource()
        # Now here's the difficult part: you need to implement the ...
        # to check that the dialog really is of the type that should be
        # closed, e.g. by checking the title, its message, etc.
        if isinstance(com, JDialog) and ...:

Toolkit.getDefaultToolkit().addAWTEventListener(DialogListener(), AWTEvent.WINDOW_EVENT_MASK)

Best regards,

Robert Theel <Robert.Theel@?.de> writes:

>    is there any easy possibility, to ask, whether a popup is
>    visible/opened?
>    the background - in our program popup-messages will often appear, but
>    they contain only info and not failures etc., so you only have to 'ok'
>    them. until now, we used  the try- and catch-mechanism with a
>    wait-for-component-action. to ease and fasten the process, a
>    possibility like the following syntax would be helpful:
>    action.1
>    if
>      do klick.button('ok')
>    else
>      do.nothing
>    action.2
>    with the 'if' you only query if a condition evaluates to true. or is
>    it possible to query the status of a component (like enabled)? or is
>    it possible to assign a status of a component to a variable?
>    thanks in advance
>    Robert

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