Don't use JButton.doClick() (which will block), use
ComponentTester.actionClick() (which will not).
On Dec 24, 2007, at 8:25 AM, NEO wrote:
> Hey ,
> Merry Christmas and Happy New Year!!!! to All
> i'm coding junit test with Abbot
>
> I want to interact with a modal Frame opened by my Application.
>
> When i click on a Delete-Button a modal frame is opened an a want
> to click on a Ok-button in this frame.
> the problem is when the frame is opened the test is stopped(modal
> frame) until the frame is closed by clicking(per hand) on Ok-button.
> How can i interact with this frame with junit code?
>
> clickButton("Delete");
> clickButton("Confirmation", "Ok");
>
> The implementations of the method clickButton() looks like
>
> public void clickButton(String strButtonName) {
> JButton button = null;
> ComponentFinder finder = getFinder();
> try {
> NameMatcher buttonMatcher = new NameMatcher(strButtonName);
>
> //Look for
> button = (JButton) finder.find(buttonMatcher);
>
> //Click on button buttonText
> button.doClick();
>
> //For Breakpoint
> System.out.println("");
>
> } catch (ComponentNotFoundException e) {
> System.err.println("Button named "+ strButtonName +" not Found");
> } catch (MultipleComponentsFoundException e) {
> System.err.println("Multiple Components named "+ strButtonName +
> " found");
> }
>
> }
> public void clickButton(String strDialogBoxTitle, String
> strButtonName){
> Frame dialogFilter = null;
> JButton button = null;
> ComponentFinder finder = getFinder();
> try {
> WindowMatcher dialogMatcher = new WindowMatcher
> (strDialogBoxTitle, true);
>
> //Look for
> dialogFilter = (Frame) finder.find(dialogMatcher);
> //For Breakpoint
> System.out.println("");
>
> } catch (ComponentNotFoundException e) {
> System.err.println("DialoBox titled "+ strDialogBoxTitle +" not
> Found");
> } catch (MultipleComponentsFoundException e) {
> System.err.println("Multiple Components named "+
> strDialogBoxTitle + " found");
> }
>
> try {
> NameMatcher buttonMatcher = new NameMatcher(strButtonName);
>
> //Look for
> button = (JButton) finder.find(dialogFilter, buttonMatcher);
> button.doClick();
> //For Breakpoint
> System.out.println("");
>
> } catch (ComponentNotFoundException e) {
> System.err.println("Button named "+ strButtonName +" not Found");
> } catch (MultipleComponentsFoundException e) {
> System.err.println("Multiple Components named "+ strButtonName +
> " found");
> }
>
>
>
> }
>
>
>
> ______________________________________________________________________
> _______
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers
> Yahoo! Mail http://mail.yahoo.fr
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> abbot-users mailing list
> abbot-users@...
> https://lists.sourceforge.net/lists/listinfo/abbot-users
Timothy Wall
http://abbot.sf.net
|