Ejemplo n.º 1
0
 def __init__(self, device, package, seed=11, number=10):
     self.device = device
     self.seed = seed
     self.number = number
     self.package = package
     self.logcat = LogcatAgent(self.device)
     #TODO add orientation and other events
     self.specialEvents = ['wifi', 'data']
     random.seed(self.seed)
Ejemplo n.º 2
0
def main():
    """ This example dumps all error messages in logcat and then clear it.
    After 5 seconds, it dumps all messages and finishes.
    Note that logcat encodes its output with utf-8
    """
    device = EMonkeyDevice()
    agent = LogcatAgent(device)
    print agent.dump(fmt=None, filterTuples=[('*', 'E')])
    agent.clear()
    print 'Waiting for 5 seconds...'
    time.sleep(5)
    print agent.dump()
Ejemplo n.º 3
0
def main():
    """ This test launches a series of apps (with given package and main activity names)
    and repeats this for a given number of times. After that, the scripts dumps the error
    messages printed to logcat during the test.
    """
    # constants
    APP_CLOCK = 'com.android.deskclock/com.android.deskclock.DeskClock'
    APP_SETTINGS = 'com.android.settings/com.android.settings.Settings'
    # configurations
    packages = [APP_SETTINGS, APP_CLOCK]
    sleep_interval = 2
    repeats = 2
    app_tag = 'ActivityManager'
    device = DeviceManager.getDevice()
    agent = LogcatAgent(device)
    agent.clear()
    print 'Start launching stress test'
    for _ in range(repeats):
        for p in packages:
            device.startActivity(component=p)
            time.sleep(sleep_interval)
    err = agent.dump(fmt=None, filterTuples=[(app_tag, 'E'), ('*', 'S')])
    print 'Finishing test, dumping error messages:'
    print err