def overwrite_test_file_name(test_config_doc, test_file_name): test_config = parse_test_config(test_config_doc) tests = get_children_with_tag(test_config, 'target_preparer') for test in tests: if test.getAttribute('class') in KNOWN_PREPARERS: options = get_children_with_tag(test, 'option') for option in options: if option.getAttribute('name') == "test-file-name": option.setAttribute('value', test_file_name)
def overwrite_test_file_name(test_config_doc, test_file_name): test_config = parse_test_config(test_config_doc) tests = get_children_with_tag(test_config, 'target_preparer') for test in tests: if test.getAttribute( 'class' ) == "com.android.tradefed.targetprep.TestAppInstallSetup": options = get_children_with_tag(test, 'option') for option in options: if option.getAttribute('name') == "test-file-name": option.setAttribute('value', test_file_name)
def overwrite_package_name(test_config_doc, manifest_doc, package_name): manifest = parse_manifest(manifest_doc) original_package = manifest.getAttribute('package') test_config = parse_test_config(test_config_doc) tests = get_children_with_tag(test_config, 'test') for test in tests: options = get_children_with_tag(test, 'option') for option in options: if option.getAttribute( 'name') == "package" and option.getAttribute( 'value') == original_package: option.setAttribute('value', package_name)