|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object InstrumentationTestRunner org.safs.android.engine.DroidEngine
public class DroidEngine
Primary InstrumentationTestRunner used for remote controlled Android Automation in associated with a TCP Messenger Service.
This is the InstrumentationTestRunner that is considered the test package usually associated with a very specific target Package to be tested. However, in the case of SAFS we want to make a completely reusable test package that is NOT built with a specific target Package association. We want this general-purpose test framework to be usable to test all Android Applications via the data-driven SAFS framework.
The initial implementation, however, is not necessarily SAFS-specific.
How the remote control mechanism works:
The test package AdroidManifest.xml does need to have the Instrumentation tags set for the target
Application to be tested. There is no getting around this:
<instrumentation android:name="org.safs.android.engine.DroidEngine" android:targetPackage="com.android.example.spinner" android:label="General-Purpose SAFS Droid Automation Framework"/>The AndroidManifest.xml then simply needs to be repackaged into a working test APK in order to test the target application.
The test consists of the following on-device assets:
1. TCP Messenger Service (SAFS Messenger Service),
2. DroidEngine test APK,
3. Target Application APK.
The remote control assets are simply:
1. Remote Controller implementing a TCP SocketServerListener,
2. TCP SocketServer binding to the on-device TCP Messenger Service for two-way communication.
There is a predefined TCP Protocol the remote TCP SocketServer and the on-device TCP Messenger Service must adhere to for proper signalling and synchronization.
When using the Droid Emulator, the remote controller must ensure the proper emulator port forwarding is set in order for the TCP Messenger Service to be able to communicate with the outside world.
MessengerService
Field Summary | |
---|---|
static java.lang.String |
resource_bind_service
|
static java.lang.String |
resource_service_attached
|
static java.lang.String |
resource_service_disconnect
|
static java.lang.String |
resource_service_release
|
static java.lang.String |
TAG
|
Constructor Summary | |
---|---|
DroidEngine()
|
Method Summary | |
---|---|
protected void |
debug(java.lang.String message)
|
void |
onCreate(Bundle savedInstanceState)
Called when the Instrumentation class is first created. |
void |
onMessengerDebug(java.lang.String message)
Receive debug logging requests from the Messenger Service |
void |
onRemoteConnected()
|
void |
onRemoteDisconnected()
|
void |
onRemoteDispatchFile(java.lang.String message)
|
void |
onRemoteDispatchProps(java.util.Properties props)
|
void |
onRemoteEngineShutdown()
Remote request/command to tell the engine to perform a normal shutdown. |
void |
onRemoteMessage(java.lang.String message)
|
void |
onRemoteShutdown()
Notification that the Remote Controller has shutdown and is no longer available. |
void |
onServiceShutdown()
Notification that the Messenger Service has shutdown and is no longer available. |
void |
onStart()
Called automatically from start(). |
void |
prepareNotification(int what)
MessengerHandler preparing information for Thread switching. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TAG
public static final java.lang.String resource_service_attached
public static final java.lang.String resource_service_disconnect
public static final java.lang.String resource_service_release
public static final java.lang.String resource_bind_service
Constructor Detail |
---|
public DroidEngine()
Method Detail |
---|
protected void debug(java.lang.String message)
public void onMessengerDebug(java.lang.String message)
onMessengerDebug
in interface MessengerListener
public void prepareNotification(int what)
prepareNotification
in interface MessengerListener
public void onRemoteDispatchProps(java.util.Properties props)
onRemoteDispatchProps
in interface MessengerListener
public void onRemoteDispatchFile(java.lang.String message)
onRemoteDispatchFile
in interface MessengerListener
public void onRemoteMessage(java.lang.String message)
onRemoteMessage
in interface MessengerListener
public void onRemoteConnected()
onRemoteConnected
in interface MessengerListener
public void onRemoteDisconnected()
onRemoteDisconnected
in interface MessengerListener
public void onRemoteShutdown()
onRemoteShutdown
in interface MessengerListener
public void onServiceShutdown()
onServiceShutdown
in interface MessengerListener
public void onRemoteEngineShutdown()
onRemoteEngineShutdown
in interface MessengerListener
public void onCreate(Bundle savedInstanceState)
doBindService()
,
getTargetPackageInfo()
,
#start()
public void onStart()
#start()
,
messageLock
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |