From 29723e692b35c3bdd4502dacfe0f64e841e9dd96 Mon Sep 17 00:00:00 2001 From: Wojtek Kowaluk Date: Wed, 3 Aug 2016 17:39:58 +0200 Subject: [PATCH] Give programs some time to start after calling Start Process This fixes #42 --- .../existing_app/existingapp_1.robot | 1 + .../acceptance/remoteswinglibrary.robot | 18 ++++++++++++------ .../acceptance/security_dialogs.robot | 18 ------------------ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/test/robotframework/acceptance/existing_app/existingapp_1.robot b/src/test/robotframework/acceptance/existing_app/existingapp_1.robot index 533a3b5..8492964 100755 --- a/src/test/robotframework/acceptance/existing_app/existingapp_1.robot +++ b/src/test/robotframework/acceptance/existing_app/existingapp_1.robot @@ -6,3 +6,4 @@ Suite setup Set Environment Variable CLASSPATH target/test-classes *** Test Cases *** Starting application with main window Start Application myapp2 java org.robotframework.remoteswinglibrary.MySwingApp 5 seconds \ False 31337 + Sleep 5s \ No newline at end of file diff --git a/src/test/robotframework/acceptance/remoteswinglibrary.robot b/src/test/robotframework/acceptance/remoteswinglibrary.robot index 14e6760..1caad25 100644 --- a/src/test/robotframework/acceptance/remoteswinglibrary.robot +++ b/src/test/robotframework/acceptance/remoteswinglibrary.robot @@ -21,7 +21,7 @@ Start application removes the JAVA_TOOL_OPTIONS from enviroment Connecting to a started application Set java tool options - ${handle}= Start Process java org.robotframework.remoteswinglibrary.MySwingApp shell=True + ${handle}= Start And Wait java org.robotframework.remoteswinglibrary.MySwingApp Application Started myjava Exit and check process ${handle} myjava Set environment variable JAVA_TOOL_OPTIONS ${EMPTY} @@ -29,9 +29,9 @@ Connecting to a started application Connecting to a specific application [Timeout] 30 seconds Set java tool options - ${handle1}= Start Process java org.robotframework.remoteswinglibrary.MySwingApp one shell=True - ${handle2}= Start Process java org.robotframework.remoteswinglibrary.MySwingApp two shell=True - ${handle3}= Start Process java org.robotframework.remoteswinglibrary.MySwingApp three shell=True + ${handle1}= Start And Wait java org.robotframework.remoteswinglibrary.MySwingApp one + ${handle2}= Start And Wait java org.robotframework.remoteswinglibrary.MySwingApp two + ${handle3}= Start And Wait java org.robotframework.remoteswinglibrary.MySwingApp three Application Started three name_contains=three Application Started one name_contains=one Application Started two name_contains=two @@ -44,7 +44,7 @@ Connecting to an application and using java agent option [Timeout] 20 seconds ${agent}= Set Variable -javaagent:"${REMOTESWINGLIBRARYPATH}"\=127.0.0.1:${REMOTESWINGLIBRARYPORT} log ${agent} - ${handle}= Start Process java ${agent} org.robotframework.remoteswinglibrary.MySwingApp shell=True + ${handle}= Start And Wait java ${agent} org.robotframework.remoteswinglibrary.MySwingApp Application Started app Exit and check process ${handle} app @@ -63,7 +63,7 @@ Unallowed SwingLibrary keywords [Teardown] System Exit Logging java properties - Start Application mapp java org.robotframework.remoteswinglibrary.MySwingApp timeout=5 seconds + Start Application mapp java org.robotframework.remoteswinglibrary.MySwingApp timeout=10 seconds ${props}= Log Java System Properties Should Contain ${props} System.getenv(): [Teardown] System Exit @@ -85,3 +85,9 @@ My Closing Keyword Switch To Application ${alias} Log something plaah System Exit + +Start And Wait + [Arguments] ${command} + ${handle}= Start Process ${command} shell=True + Sleep 5s + [Return] ${handle} diff --git a/src/test/robotframework/acceptance/security_dialogs.robot b/src/test/robotframework/acceptance/security_dialogs.robot index d5120da..98103bd 100644 --- a/src/test/robotframework/acceptance/security_dialogs.robot +++ b/src/test/robotframework/acceptance/security_dialogs.robot @@ -13,21 +13,3 @@ Close Security Dialogs Again Start Application App java org.robotframework.remoteswinglibrary.SecurityDialogsApp 30 seconds \ True Select Main Window Close Window Test - -*** Keywords *** -Keyword Should Not Exist - [Arguments] ${keyword} - Run Keyword And Expect Error No keyword with name '${keyword}' found. Keyword Should Exist ${keyword} - -Exit and check process - [Arguments] ${handler} ${alias} - Switch To Application ${alias} - Process Should Be Running ${handler} - System Exit - Wait until keyword succeeds 5 seconds 0.5 seconds Process Should Be Stopped ${handler} - -My Closing Keyword - [Arguments] ${alias} - Switch To Application ${alias} - Log something plaah - System Exit