首页 > 解决方案 > 如何在 Appcenter 构建后脚本中执行所有 Android JUnit 测试

问题描述

我是使用 AppCenter 构建 Android 的新手,并希望执行我所有的 Apps JUnit。

我的应用程序由多个模块组成,每个模块都有关联的 JUnit。

但是我的主 App 模块没有 JUnit。

我试过创建一个appcenter-post-build.sh脚本来执行命令./gradlew test

失败如下: -

[command]/bin/bash /Users/runner/work/1/s/app/appcenter-post-build.sh
/Users/runner/work/1/s/app/appcenter-post-build.sh: line 5: ./gradlew: No such file or directory

##[error]The process '/bin/bash' failed with exit code 127
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 127

有什么方法可以通过构建后脚本执行我的所有应用程序模块 JUnit?

标签: androidgradlewvisual-studio-app-center

解决方案


尝试将其添加到您的 shell 脚本中。

cd $APPCENTER_SOURCE_DIRECTORY
chmod a+x ./gradlew

推荐阅读