使用fastlane / scan运行测试


快速通道/扫描

scan.png (1759×652)

快速通道/扫描负责在快速通道系列中运行测试。
我已经接触过fastlane系列很多东西,但是我认为这是最简单,最容易理解的。

你能做什么

到目前为止

如果要在命令行上运行Xcode测试,则必须键入如下命令:

1
2
3
4
5
6
xcodebuild \
  -workspace MyApp.xcworkspace \
  -scheme "MyApp" \
  -sdk iphonesimulator \
  -destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
  test

这不是人类输入的字符。

使用扫描

通过编写配置文件,您可以通过简单地执行扫描命令:relaxed:

来运行测试。

1
bundle exec fastlane scan

如何使用

ruby文件

1
gem 'fastlane'

bundle install --path vendor/bundle

扫描文件

键入

fastlane scan init创建一个Scanfile模板,并根据需要对其进行修改。
我写如下。

1
2
3
4
5
6
7
8
9
10
scheme "HogeTests"
configuration "Staging"

device "iPad Retina"
workspace "hoge.xcworkspace"

open_report true
clean true
skip_build true
output_types "html"

运行

bundle exec fastlane scan编译和测试并显示测试结果:tada:

1
2
3
4
5
6
+--------------------+-----+
|       Test Results       |
+--------------------+-----+
| Number of tests    | 224 |
| Number of failures | 0   |
+--------------------+-----+

便捷功能

懈怠的合作

执行测试时,它将像这样链接。
(ENV [" SLACK_URL"]需要webhook网址)

unspecified.png

显示测试结果

output_types" html"给出了很好的测试结果。
如果还写了测试所需的时间,那就太好了。

unspecified.png

也可以提供覆盖

在iOS开发中链接拉取请求和测试范围//发言人甲板