Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1773299] |
Tue, 26 September 2017 04:57  |
Eclipse User |
|
|
|
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 08:40] by Moderator
|
|
|
|
|
|
Re: Jubula API JAVA Swing "Timeout received" & "ActionException" [message #1776280 is a reply to message #1774726] |
Tue, 14 November 2017 17:47  |
Eclipse User |
|
|
|
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 17:55] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04883 seconds