How to write a Git pre-commit hook that prevents committing of an Android project if the test project fails?

送分小仙女□ 提交于 2019-12-07 11:34:24
AD7six

git hooks are executed from your project/repo root - so you should be able to just use your command directly in a precommit hook:

#!/bin/bash
adb shell am instrument -w com.mydomain.tests/android.test.InstrumentationTestRunner

if adb returns a none-zero exist code on failure - the commit will be aborted.

If you need to get the exit code for another purpose there are other questions indicating exactly how to do that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!