Skip to content

Instantly share code, notes, and snippets.

@superjohan
Created June 2, 2016 10:35
Show Gist options
  • Save superjohan/297e79c4e10f80ed55e393c15670e88a to your computer and use it in GitHub Desktop.
Save superjohan/297e79c4e10f80ed55e393c15670e88a to your computer and use it in GitHub Desktop.
small looping test runner to help find flaky tests on Android
import subprocess
import shlex
import shutil
def run():
times_run = 1
failures = 0
while True:
print('# run: {}, failures: {}'.format(times_run, failures))
try:
subprocess.check_call(shlex.split('./gradlew --quiet connectedAndroidTest'))
except subprocess.CalledProcessError as e:
failures += 1
output_dir = 'tmp/{}'.format(times_run)
shutil.copytree('<<insert app here>>/build/reports/androidTests/connected', output_dir)
times_run += 1
if __name__ == '__main__':
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment