gpt4 book ai didi

用于 Jenkins 管道的 Android 模拟器

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:20 24 4
gpt4 key购买 nike

寻找可以在管道作业中模拟 Android 的 Jenkins 插件。

This plug-in在 Freestyle 工作中表现良好,但 doesn't support pipelines在这个时间点。

有没有其他方法可以通过 Jenkins 管道在 Android 上运行功能测试?

最佳答案

这是我的解决方案。希望对您有所帮助。

node {
try{
def ANDROID_HOME='/opt/android-sdk-linux'
def ADB="$ANDROID_HOME/platform-tools/adb"

stage('Stage Checkout') {
git branch: 'develop', credentialsId: 'd9f13c8b-f917-4374-8849-2b9730885333', url: 'http://git.hostname.com/something.git'
}

stage('Stage Build') {
sh "./gradlew clean assembleRelease"
}

stage('Stage Unit Tests') {
sh "./gradlew testReleaseUnitTest"
}

stage('Stage Instumental Tests') {
sh "$ADB start-server"

def error
parallel (
launchEmulator: {
sh "$ANDROID_HOME/tools/qemu/linux-x86_64/qemu-system-x86_64 -engine classic -prop persist.sys.language=en -prop persist.sys.country=US -avd test -no-snapshot-load -no-snapshot-save -no-window"
},
runAndroidTests: {
timeout(time: 20, unit: 'SECONDS') {
sh "$ADB wait-for-device"
}
try {
sh "./gradlew :MyKet:connectedAndroidTest"
} catch(e) {
error = e
}
sh script: '/var/lib/jenkins/kill-emu.sh'
}
)
if (error != null) {
throw error
}
}
currentBuild.result = "SUCCESS"
} catch (e) {
currentBuild.result = "FAILED"
// notifyFailed()
throw e
} finally {
stage('Stage Clean') {
sh script: '/var/lib/jenkins/clean.sh'
}
}
}

关于用于 Jenkins 管道的 Android 模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39566514/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com