持续集成体系建设,自动部署与自动测试的shell 代码:
. ~/.bash_profile
pwd=pwd
apk=$pwd/…/Build_AndroidPackage_python/AndroidSampleApp/app/build/outputs/apk/debug/app-debug.apk
{
#卸载现有的安卓app
#try
adb uninstall com.appsflyer.androidsampleapp
} || {
#catch
echo ‘no com.appsflyer.androidsampleapp package’
}
#安装安卓app
adb install $apk
cd iAppBVT_Python
#更新python依赖库
pip3.9 install -r requirements.txt
#运行自动化测试
pytest -sv test/bvt_test.py --tc-file /your_path/iAppBVT_Python.json --tc-format json
接口自动化持续集成job:
App 打包、部署、UI 自动化测试持续集成job(
踩坑提醒:打包时使用代理会报错,需关闭代理):
邮件通知:
LTQ_549
(李淘气)
4
接口自动化持续集成:
安卓App构建、打包、部署与自动化测试:!
-
安卓App打包
-
部署以及自动化测试
-
构建成功,邮件通知
**注释:在appui-test的shell 中定义了apk= $pwd/…/sample_app/AndroidSampleApp/app/build/outputs/apk/debug/app-debug.apk,但是在构建的时候报错。度娘上也没有查找到解决办法。最后只能通过在终端中手动的进行 install 安卓包。报错截图如下:希望老师看到后能给提供解决办法,谢谢。
**
app自动打包测试的job,jenkins在云服务器上,没办法运行,贴job内容
‘’’
def gitClone(path, git_url) {
sh("""
rm -rf $path;
mkdir -p $path;
cd $path;
git clone $git_url
“”")
}
def getPwdAndLs(){
// def pwd_res=sh(script: “pwd”, returnStdout: true).trim();
sh(""“pwd”"");
// def ls_res=sh(script: “ls”, returnStdout: true).trim();
sh(""“ls”"")
}
node {
def root_dir = “/var/jenkins_home/workspace/APP_CI_START”;
stage('build') {
echo "哦,我的王母娘娘啊build";
sh("""
echo ${env.name};
echo ${env.cases};
echo ${env.devices};
""")
gitClone("AndroidSampleApp", "https://github.com/AoeRunner/AndroidSampleApp.git");
getPwdAndLs();
// sh 'gradlew clean assembleDebug'
}
stage('install'){
echo "德玛西亚万岁install";
sh("""
cd $root_dir/AndroidSampleApp/AndroidSampleApp;
ls;
""");
getPwdAndLs();
// gradlew clean assembleDebug;
// apk=$pwd_res/…/Build_AndroidPackage_python/AndroidSampleApp/app/build/outputs/apk/debug/app-debug.apk;
// adb install -r $apk;
}
stage('test'){
echo "我的个亲娘嘞test";
gitClone("iAppBVT_Python", "https://github.com/AoeRunner/iAppBVT_Python.git");
sh("""
cd $root_dir/iAppBVT_Python/iAppBVT_Python;
ls;
pip3 install -r requirements.txt;
echo ${env.BUILD_URL};
echo ${env.JOB_URL};
""");
getPwdAndLs();
// pytest -sv test/bvt_test.py --tc-file /your_path/iAppBVT_Python.json --tc-format json
}
}
‘’’
web自动运行的job
‘’’
pwd
ls
cd Iselenium_python
pwd
ls
pip3 install -r requirements.txt
pytest -sv test/web_ut.py --alluredir ./allure-results
‘’’