diff --git a/README.md b/README.md index dbc703e..82d4dd0 100644 --- a/README.md +++ b/README.md @@ -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` + diff --git a/setup.py b/setup.py index 79e95b9..f726a6a 100644 --- a/setup.py +++ b/setup.py @@ -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, diff --git a/testdroid/__init__.py b/testdroid/__init__.py index fb3337b..ddd4ee6 100755 --- a/testdroid/__init__.py +++ b/testdroid/__init__.py @@ -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) @@ -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): @@ -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) @@ -524,6 +536,11 @@ def format_epilog(self, formatter): upload-application Upload application to project upload-test Upload test file to project upload-data Upload additional data file to project + set-project-config + 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 Start a test run start-wait-download-test-run Start a test run, await completion (polling) and @@ -532,10 +549,11 @@ def format_epilog(self, formatter): test-runs Get test runs for a project test-run Get test run details device-runs Get device runs for a test run - download-test-run Download test run data. Data will be downloaded to + download-test-run + 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 + download-test-screenshots Download test run data. Data will be downloaded to current directory in a structure: [test-run-id]/[device-run-id]-[device-name]/files... @@ -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,