Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Jubula API JAVA Swing "Timeout received" & "ActionException"(Timeout received before confirming the posted event)
Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1773299] Tue, 26 September 2017 08:57 Go to next message
Rdg Kentin is currently offline Rdg KentinFriend
Messages: 6
Registered: September 2017
Junior Member
Hello everybody !
I just started using the Jubula API to create automatic tests.
For the moment I am trying to launch an automatic test via the API and the SimpleAdder provides as an example of Jubula. When i start my test i have this execption : Timeout received before confirming the posted event
Here is my code:

public class SimpleAdder2 {
    /** the value1 */
    private static TextInputComponent value1;
    /** the value2 */
    private static TextInputComponent value2;
    /** the button */
    private static GraphicsComponent button;
    /** the result */
    private static TextComponent result;
    /** the AUT */
    private static AUT m_aut;
    /** the AUT */
    private static AUTAgent autAgent;

    /** global prepare */
    @SuppressWarnings("unchecked")
    @BeforeClass
    public static void loadObjectMapping() throws Exception {

        URL input = SimpleAdder2.class.getClassLoader().getResource("objectMapping_AUTName.properties");
        if (input != null) {
            System.out.println("ObjectMapping properties find !");
            ObjectMapping objectMapping = MakeR.createObjectMapping(input.openStream());

            ComponentIdentifier<ButtonComponent> buttonId = objectMapping.get("equalsButton");
            button = SwingComponents.createAbstractButton(buttonId);

            ComponentIdentifier<TextInputComponent> value1Id = objectMapping.get("value1");
            value1 = SwingComponents.createJTextComponent(value1Id);

            ComponentIdentifier<TextInputComponent> value2Id = objectMapping.get("value2");
            value2 = SwingComponents.createJTextComponent(value2Id);

            ComponentIdentifier<TextComponent> resultFieldId = objectMapping.get("resultField");
            result = SwingComponents.createJLabel(resultFieldId);
        } else {
            System.out.println("Can't find objectMapping properties");
        }

    }

    /** prepare */
    @Before
    public void setUp() throws Exception {
        System.out.println("createAUTAgent");
        autAgent = MakeR.createAUTAgent("localhost", 60000);
        try {
            autAgent.connect();
            System.out.println("AUTAgent connection success");
            SwingAUTConfiguration autConfiguration = new SwingAUTConfiguration("AUTName", "AUTId", "SimpleAdder.cmd",
                    "C:\\Program Files\\jubula_8.5.0.127\\examples\\AUTs\\SimpleAdder\\swing", null);

            AUTIdentifier id = autAgent.startAUT(autConfiguration);
            m_aut = autAgent.getAUT(id, SwingComponents.getToolkitInformation());
            m_aut.connect();
            System.out.println("AUT connected");

        } catch (Exception e) {
            System.out.println("AUTAgent connection failed");
        }
    }

    /** the actual test method */
    @Test(expected = CheckFailedException.class)
    public void testTestFirstSimpleAdderSteps() throws Exception {
        System.out.println("Test start");
        final int firstValue = 17;
        List<Result<String>> results = new ArrayList<Result<String>>();

        System.out.println("aut = " + m_aut + "value1 = " + value1);
        try {
            for (int i = 1; i < 5; i++) {
                results.add(m_aut.execute(value1.replaceText(String.valueOf(firstValue)), "Entering first value")); //$NON-NLS-1$
                results.add(m_aut.execute(value2.replaceText(String.valueOf(i)), "Entering second value")); //$NON-NLS-1$
                results.add(m_aut.execute(button.click(1, InteractionMode.primary), "Invoking calculation")); //$NON-NLS-1$
                results.add(m_aut.execute(result.checkText(String.valueOf(firstValue + i), Operator.equals),
                        "Checking result")); //$NON-NLS-1$
            }
        } finally {
            System.out.println("finally");
        }
    }

    /** cleanup */
    @After
    public void tearDown() throws Exception {
        System.out.println("Disconnect AUT Agent and AUT");
        if (m_aut != null) {
            m_aut.disconnect();
            autAgent.stopAUT(m_aut.getIdentifier());
        }
        autAgent.disconnect();
    }
}



I receive this Timeout received before confirming the posted event and ActionException

Thank you

Best regards,

Kentin

[Updated on: Wed, 27 September 2017 12:40]

Report message to a moderator

Re: Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1773544 is a reply to message #1773299] Fri, 29 September 2017 06:22 Go to previous messageGo to next message
Marvin Mueller is currently offline Marvin MuellerFriend
Messages: 255
Registered: March 2012
Senior Member
Hello Kentin,

can you be more specific where the error is happening and which Operating System you are using?

I assume this error is happening during the click but may also be happening during the replace text. This error might happen if the AUT has no focus(or is in the background) and therefore we have problems doing our actions. If the Application is in the background please bring it to the front by yourself, normally during nightly test the Application is by itself on the Desktop.
If it just has no focus we have also actions for this.

Application application = SwingComponents.createApplication();

results.add(m_aut.execute(application.activate(AUTActivationMethod.center), "Invoke activate application")); //$NON-NLS-1$



best regards
Marvin
Re: Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1773549 is a reply to message #1773544] Fri, 29 September 2017 07:21 Go to previous messageGo to next message
Rdg Kentin is currently offline Rdg KentinFriend
Messages: 6
Registered: September 2017
Junior Member

Thank you very much. You're right, it did not work because the application was in the background. There is not a java method to make it come first.

It's my message when the application is in background :
Error occured ActionException
Timeout received before confirming the posted event
Re: Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1774726 is a reply to message #1773549] Thu, 19 October 2017 06:35 Go to previous messageGo to next message
Marvin Mueller is currently offline Marvin MuellerFriend
Messages: 255
Registered: March 2012
Senior Member
We have no action to get it directly from the background to top, this is a non trivial task. Therefore we recommend that you bring it on top yourself(if you are writing test and want to execute them) or if you are running nightly test that no other application is present during the test.

best regards
Marvin
Re: Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1776280 is a reply to message #1774726] Tue, 14 November 2017 22:47 Go to previous message
Milos Hroudny is currently offline Milos HroudnyFriend
Messages: 24
Registered: June 2017
Junior Member
Hi,
you can use AutoIt to solve the situation. Compile the AutoIt script

Opt("WinTitleMatchMode",2)
WinActivate($CmdLine[1])

You can name the script WinActivate.au3 and after compile you get
WinActivate.exe. Call this external command with one parameter
containing the string from window titlebar and your application will be on the top.
Best Regards
Milos

[Updated on: Tue, 14 November 2017 22:55]

Report message to a moderator

Previous Topic:Error when I execute test
Next Topic:Creating a custom JFace based extension
Goto Forum:
  


Current Time: Fri Mar 29 10:21:54 GMT 2024

Powered by FUDForum. Page generated in 0.02324 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top