Permalink
Browse files

Added ability to start only JsTestDriver

Specifying only the first two arguments will start the JsTestDriver server
  without the Android emulator.
  • Loading branch information...
1 parent 1f418e0 commit c5b342d8f62ebd4fa0fb99c6a86550219881aa42 @eromba committed Oct 13, 2011
Showing with 23 additions and 8 deletions.
  1. +6 −1 README.md
  2. +17 −7 jtd-android-init.py
View
@@ -16,8 +16,12 @@ capturing the emulator's web browser in the JsTestDriver server instance.
## Usage
+To initialize JsTestDriver and the Android emulator:
`jtd-android-init.py [Path to JTD] [Port] [Path to SDK] [AVD] [Delay]`
+To initialize only JsTestDriver:
+`jtd-android-init.py [Path to JTD] [Port]`
+
- **Path to JTD** : The path to your JsTestDriver JAR file
- **Port** : The port on which to start the JsTestDriver server
- **Path to SDK** : The path to your local Android SDK directory
@@ -28,4 +32,5 @@ capturing the emulator's web browser in the JsTestDriver server instance.
## Current Limitations
- Does not support capturing the browser of a USB-connected Android device.
-- Does not support capturing multiple emulator instances.
+- Does not support capturing multiple emulator instances.
+
View
@@ -18,8 +18,12 @@
#
# === Usage ===
#
-# jtd-android-init.py [Path to JTD] [Port] [Path to SDK] [AVD] [Delay]
+# To initialize JsTestDriver and the Android emulator:
+# jtd-android-init.py [Path to JTD] [Port] [Path to SDK] [AVD] [Delay]
#
+# To initialize only JsTestDriver:
+# jtd-android-init.py [Path to JTD] [Port]
+#
# - Path to JTD : The path to your JsTestDriver JAR file
# - Port : The port on which to start the JsTestDriver server
# - Path to SDK : The path to your local Android SDK directory
@@ -86,18 +90,21 @@ def AndroidBrowserIsCaptured():
#
-if len(sys.argv) != 6:
+numArgs = len(sys.argv)
+
+if numArgs != 3 and numArgs != 6:
print("Usage: jtd-android-init.py [Path to JTD] [Port] [Path to SDK] [AVD] [Delay]")
exit(1)
JTD_PATH = sys.argv[1]
JTD_PORT = sys.argv[2]
-SDK_PATH = sys.argv[3]
-AVD_NAME = sys.argv[4]
-DELAY = sys.argv[5]
-ADB_PATH = os.path.abspath( os.path.join(SDK_PATH, "platform-tools/adb") )
-EMULATOR_PATH = os.path.abspath( os.path.join(SDK_PATH, "tools/emulator") )
+if numArgs == 6:
+ SDK_PATH = sys.argv[3]
+ AVD_NAME = sys.argv[4]
+ DELAY = sys.argv[5]
+ ADB_PATH = os.path.abspath( os.path.join(SDK_PATH, "platform-tools/adb") )
+ EMULATOR_PATH = os.path.abspath( os.path.join(SDK_PATH, "tools/emulator") )
#
@@ -119,6 +126,9 @@ def AndroidBrowserIsCaptured():
subprocess.Popen(["xterm", "-e", "java", "-jar", JTD_PATH, "--port", JTD_PORT])
print("JsTestDriver started")
+if numArgs == 3:
+ exit(0)
+
#
# Launch the given Android emulator if it is not already running

0 comments on commit c5b342d

Please sign in to comment.