We are hiring ! See our job offers.
Revision b4052e61857a54a5608e92494b6cdfa26bd22b22 authored by muncus@gmail.com on 21 January 2012, 19:34:49 UTC, committed by muncus@gmail.com on 21 January 2012, 19:34:49 UTC
git-svn-id: https://klaxon.googlecode.com/svn/trunk@144 c4afc712-db7e-11dd-87b6-9d1a99559f42
1 parent 108246e
Raw File
monkey_tests.py
# monkeyrunner script to install current klaxon, and run its tests.
# Author: Marc Dougherty <muncus@gmail.com>

import os

from com.android.monkeyrunner import MonkeyDevice, MonkeyRunner

INSTRUMENTATION_RUNNER = 'android.test.InstrumentationTestRunner'

device = MonkeyRunner.waitForConnection()

device.installPackage('bin/Klaxon-debug.apk')
device.installPackage('tests/bin/KlaxonTests-debug.apk')
package = 'org.nerdcircus.android.klaxon'
activity = package + ".KlaxonList"

test_dict = device.instrument("%s/%s" % (package+'.tests', INSTRUMENTATION_RUNNER))

assert 'OK' in test_dict['stream']
print test_dict['stream']

# try to send some smses through adb.
def sendSms(sender="11111", text="blah"):
  os.system("adb emu 'sms send %(sender)s %(text)s'" % {
      'sender': sender,
      'text': text,})

sendSms(text="blah blah blah")

#import socket
#sock = socket.socket()
#sock.connect(('localhost', 5554))
#sock.recv(300) # eat the banner.

#pattern = "sms send 424242 %(msg)s\n"

#for m in ['foo', 'Foo', 'FOO']:
#  sock.send(pattern % {'msg': m})
#  assert 'OK' in sock.recv(10)
back to top