自动化测试jenkins集成

创建测试目录

1、在jenkins的workspace目录下创建测试工程的目录

cd /Users/developer/.jenkins/workspace
mkdir TuandaiFund_iOS_Tests

2、编写测试脚本,参考使用ruby编写测试用例

注意:appium.txt文件中app参数对应的值,指定为待测app的绝对路径
使用xcodebuild -workspace TuandaiFund.xcworkspace -sdk iphonesimulator11.2 -scheme TuandaiFund 查看这条命令输出的app目录,指定为这个地址即可

安装插件

下载cucumber-reports.hpi

打开jenkins->系统管理->管理插件->高级->上传cucumber-reports.hpi

image.png

定时构建

配置触发器

打开jenkins新建一个自由风格的工程TuandaiFund_iOS_Tests

选择构建触发器->选择Build periodically,设置日程表为H 17 * * 1-5,表示每天下午5点构建

image.png

配置脚本

# 进入jenkins的workspace目录
cd /Users/developer/.jenkins/workspace/TuandaiFund_iOS 

# 编译工程生产app文件
xcodebuild -workspace TuandaiFund.xcworkspace -sdk iphonesimulator11.2 -scheme TuandaiFund

# 进入测试目录
cd /Users/developer/.jenkins/workspace/TuandaiFund_iOS_Tests/tests/ruby

# 按照ruby依赖库
bundle install

# 自动化测试并输出报表
cucumber --format json -o /Users/developer/.jenkins/workspace/TuandaiFund_iOS_Tests/report/cucumber.json

集成测试报告

1、选择增加构建后的操作->选择Cucumber reports

2、指定报告Json的路径

3、设置File Include Pattern为**/*.json,使用正则匹配测试报告的json文件

image.png

邮件通知

1464430-c532429eb396f6af (1).png

报告示例

image.png
image.png
image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容