58 / 66 · 09 Mobile & Cross-Platform Testing · On-Device ML Model Testing← prev⊞ allnext →☰ Read as one page
10.6Testing OTA Model Updates
def test_model_update_applies_correctly(driver):
"""Over-the-air model updates should apply on next app launch."""
# Get current model version
model_info = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "model-version")
original_version = model_info.text
# Trigger model update check
driver.find_element(AppiumBy.ACCESSIBILITY_ID, "check-model-update").click()
# Wait for download
import time
time.sleep(10)
# Restart app to load new model
driver.terminate_app("com.app")
driver.activate_app("com.app")
# Verify new model version is loaded
model_info = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "model-version")
new_version = model_info.text
# Version should be different (assuming an update was available)
# In CI, you can stage a test model update
assert new_version != original_version or new_version == "latest"