Created
June 2, 2016 10:35
-
-
Save superjohan/297e79c4e10f80ed55e393c15670e88a to your computer and use it in GitHub Desktop.
small looping test runner to help find flaky tests on Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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