Cross-platform test runner
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 7 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 2 年前 | ||
| 5 年前 |
Marathon 是一个帮助在最短时间内执行测试的项目。具体来说,它通过调整环境和测试的不稳定性来确保测试执行的 稳定性,并通过高度并行化实现最佳 性能。
太长不读
Marathon 是一个快速、跨平台的测试运行器,专注于性能和稳定性。它为 Android 和 iOS 提供了易于使用的平台实现,并提供了与自定义硬件农场和更多技术栈使用的 API。
Marathon 实现了测试执行中的多个关键概念,如测试 批量处理、设备池、测试 分片、测试 排序、预防性重试 以及 事后重试。默认情况下,大多数这些设置都是保守的,但鼓励自定义配置以优化性能和/或稳定性。
Marathon 的主要关注点是 完全控制测试执行的稳定性、测试性能和成本之间的平衡。
更多信息请见 文档
概述
性能
Marathon 考虑到了测试执行的两个关键方面:
- 测试的持续时间
- 测试通过的概率
只有考虑到测试的预期持续时间来规划测试的执行,测试运行才能尽可能快地完成。另一方面,我们需要解决环境和测试本身的不稳定性问题。测试通过的概率是衡量不稳定性的一个关键指标。
Marathon 采取以下步骤确保每次测试运行尽可能平衡:
- 不稳定性策略会根据当前实时统计数据为预计在测试运行中失败的测试排队预防性重试
- 排序策略会优先执行长时间测试,以便如果发生意外的重试尝试,它不会对测试运行产生重大影响(例如在执行结束)
- 如果其他方法都失败了,我们会回到事后重试,但我们尝试限制它们对运行的影响,使用重试配额
配置
在项目根目录创建一个基本的 Marathonfile,内容如下:
Android:
name: "My application"
outputDir: "build/reports/marathon"
vendorConfiguration:
type: "Android"
applicationApk: "dist/app-debug.apk"
testApplicationApk: "dist/app-debug-androidTest.apk"
iOS:
name: "My application"
outputDir: "derived-data/Marathon"
vendorConfiguration:
type: "iOS"
bundle:
application: "sample.app"
testApplication: "sampleUITests.xctest"
testType: xcuitest
供应商部分描述了平台特定的详细信息。
由于 iOS 没有任何方法来发现远程执行设备,您必须通过使用 Marathondevices 文件来提供您的模拟器:
workers:
- transport:
type: local
devices:
- type: simulator
udid: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
- type: simulatorProfile
deviceType: com.apple.CoreSimulator.SimDeviceType.iPhone-13-mini
此 Marathondevices 文件定义了一系列用于操作的 macOS 实例和模拟器列表。Marathon 可以使用预先配置的模拟器,但在需要时也可以配置新的模拟器。
上述示例中使用了本地实例来执行 marathon,但您可以通过 SSH 连接更多实例。
ℹ️ 运行 marathon 的实例不仅限于 macOS:如果您使用远程 macOS 实例,那么您可以轻松地从 Linux 等系统开始 marathon 运行。
关于提供设备的信息,您可以在 workers 文档 中找到更多详细内容。
测试的文件结构应如下所示:
Android:
foo@bar $ tree .
.
├── Marathonfile
├── dist
│ ├── app-debug.apk
│ ├── app-debug-androidTest.apk
iOS:
foo@bar $ tree .
.
├── Marathondevices
├── Marathonfile
├── build
│ ├── my.app
│ ├── my.xctest
执行
在您的项目根目录启动测试运行器
$ marathon
XXX [main] INFO com.malinskiy.marathon.cli.ApplicationView - Starting marathon
XXX [main] INFO com.malinskiy.marathon.cli.config.ConfigFactory - Checking Marathonfile config
...
要求
Marathon 需要 Java 运行环境 17 或更高版本。
加速测试,使用 Marathon Cloud
贡献指南
请参阅 贡献文档
许可协议
Marathon 代码库遵循 GPL 2.0 许可协议,以下为可选组件及其特定许可: