Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ Example:
>>> testdroid.get_test_run(1233, 12345)
{u'displayName': u'Test Run 1', u'logZipState': u'BLANK', u'screenshotZipState': u'BLANK', u'projectId': 12340, u'number': 1, u'successRatio': 0.814815, u'createTime': 1393595647000, u'executionRatio': 1.0, u'state': u'FINISHED', u'startedByDisplayName': u'John Doe', u'id': 10}
```

+Developing and testing
----------------------

Set up sandbox

`virtualenv myenv && source myenv/bin/activate`

Build example

`python setup.py clean && python setup.py sdist && pip install -U dist/testdroid-0.1.2dev.tar.gz && bin/testdroid-api-client me`

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages
import sys, os

version = '0.1.4'
version = '0.1.5'

setup(name='testdroid',
version=version,
Expand Down
29 changes: 24 additions & 5 deletions testdroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from datetime import datetime

FORMAT = '%(message)s'
__version__ = '0.1.3'
__version__ = '0.1.5'
logging.basicConfig(format=FORMAT)
logger = logging.getLogger('testdroid')
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -317,6 +317,18 @@ def set_project_parameters(self, project_id, parameters):
path = "/users/%s/projects/%s/config/parameters" % ( me['id'], project_id )
reply = self.post(path=path, payload=parameters)


""" Set project config according to http://docs.testdroid.com/_pages/client.html#project-config
"""
def set_project_config(self, project_id, payload):
#set the project config to reflect the given json payload
#e.g.: {'usedDeviceGroupId': 1234}
if isinstance(payload, str):
payload=json.loads(payload)
me = self.get_me()
path = "/users/%s/projects/%s/config" % ( me['id'], project_id )
return self.post(path=path, payload=payload)

""" Start a test run on a device group
"""
def start_test_run(self, project_id, device_group_id=None, device_model_ids=None):
Expand All @@ -337,8 +349,8 @@ def start_test_run(self, project_id, device_group_id=None, device_model_ids=None
print "Device group %s not found" % device_group_id
sys.exit(1)
# Update device group
path = "/users/%s/projects/%s/config" % ( me['id'], project_id )
reply = self.post(path=path, payload={'usedDeviceGroupId': device_group_id})

reply = self.set_project_config(project_id=project_id, payload={'usedDeviceGroupId': device_group_id})
if int(reply['usedDeviceGroupId']) != int(device_group_id):
print "Unable to set used device group to %s for project %s" % (device_group_id, project_id)
sys.exit(1)
Expand Down Expand Up @@ -524,6 +536,11 @@ def format_epilog(self, formatter):
upload-application <project-id> <filename> Upload application to project
upload-test <project-id> <filename> Upload test file to project
upload-data <project-id> <filename> Upload additional data file to project
set-project-config <project-id> <config-json>
Change the project config parameters as facilitated by the API:
http://docs.testdroid.com/_pages/client.html#project-config
e.g.:
./testdroid-api-client set-project-config 1234 '{"limitationType":"CLASS", "limitationValue":"com.foo.test.VerifyFoo"}'
start-test-run <project-id> <device-group-id> Start a test run
start-wait-download-test-run <project-id> <device-group-id>
Start a test run, await completion (polling) and
Expand All @@ -532,10 +549,11 @@ def format_epilog(self, formatter):
test-runs <project-id> Get test runs for a project
test-run <project-id> <test-run-id> Get test run details
device-runs <project-id> <test-run-id> Get device runs for a test run
download-test-run <project-id> <test-run-id> Download test run data. Data will be downloaded to
download-test-run <project-id> <test-run-id>
Download test run data. Data will be downloaded to
current directory in a structure:
[test-run-id]/[device-run-id]-[device-name]/files...
download-test-screenshots <project-id> <test-run-id>
download-test-screenshots <project-id> <test-run-id>
Download test run data. Data will be downloaded to
current directory in a structure:
[test-run-id]/[device-run-id]-[device-name]/files...
Expand Down Expand Up @@ -564,6 +582,7 @@ def get_commands(self):
"upload-application": self.upload_application_file,
"upload-test": self.upload_test_file,
"upload-data": self.upload_data_file,
"set-project-config": self.set_project_config,
"start-test-run": self.start_test_run,
"start-wait-download-test-run":self.start_wait_download_test_run,
"wait-test-run":self.wait_test_run,
Expand Down