【问题标题】:How can i get the result of a test (fail/pass) written in to a variable/file when testing with Detox on TravisCI在 TravisCI 上使用 Detox 进行测试时,如何将测试结果(失败/通过)写入变量/文件
【发布时间】:2019-05-24 05:15:21
【问题描述】:

我正在使用 TravisCI 构建我的 React Native 应用程序,并使用 Detox 在该版本上运行 E2E。

Detox 测试结果打印到 travis 控制台,但我需要知道失败或传入 env var,以便我可以采取行动。

测试命令为:

detox test --configuration ios.sim.debug

所以我试过了:

export SANITY_RES=$(detox test --configuration ios.sim.debug)

echo $SANITY_RES 只包含:

configuration="ios.sim.debug" artifactsLocation="artifacts/ios.sim.debug.2018-12-25 14-42-58Z" node_modules/.bin/jest e2e --config=e2e/ config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)$' detox[80481] 信息:[DetoxServer.js] 服务器正在监听 localhost:51067... *

而不是最终结果。 我还有其他方法可以得到它们吗?

【问题讨论】:

    标签: react-native travis-ci detox


    【解决方案1】:

    Detox 允许您编写构建日志。更多详情请查看https://github.com/wix/Detox/blob/master/docs/APIRef.Artifacts.md

    如果您将—record-logs all 添加为detox test 的标志,它将保存构建的所有日志,如果您只想要失败测试的日志,请将其更改为—record-logs failing

    您甚至可以指定日志的存储位置。

    【讨论】:

      猜你喜欢
      • 2019-01-04
      • 1970-01-01
      • 1970-01-01
      • 2019-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多