gpt4 book ai didi

SBT - 如何使 InputTask 依赖于一项任务并最终执行另一项任务

转载 作者:行者123 更新时间:2023-12-03 23:58:53 26 4
gpt4 key购买 nike

我们正在为一些自动化的 Android UI 测试组合一个 SBT Build。目的是启动 Appium 服务器,启动 Android 模拟器,运行测试,然后关闭所有内容。我们已经为“测试”SBT 命令工作了:

(test in Test) <<= 
(stopVirtual, (test in Test), saveProcessVirtualKey)
{
(stop, test, saveProcessVirtualKey) => test.dependsOn(saveProcessVirtualKey).doFinally(stop)
}

我们在尝试使用 'testOnly' 命令执行相同操作时遇到问题,该命令应该接受一个字符串参数来指定要运行的特定测试。到目前为止,我们得到的是:
(testOnly in Test) <<=
(stopVirtual, (testOnly in Test), saveProcessVirtualKey)
{
(stop, test, saveProcessVirtualKey) => test.dependsOn(saveProcessVirtualKey).doFinally(stop)
}

确实我们需要让 InputTask 依赖于 saveProcessVirtualKey 和 doFinally stopVirtual。这可能吗?

最佳答案

sbt 已内置 test setup and cleanup .

Specify setup and cleanup actions using Tests.Setup and Tests.Cleanup. These accept either a function of type () => Unit or a function of type ClassLoader => Unit. The variant that accepts a ClassLoader is passed the class loader that is (or was) used for running the tests. It provides access to the test classes as well as the test framework classes.



Test / testOptions += Tests.Setup( () => println("Setup") )
Test / testOptions += Tests.Cleanup( () => println("Cleanup") )

那行得通吗?

我第二次发帖是因为我之前的回答被版主删除了。

关于SBT - 如何使 InputTask 依赖于一项任务并最终执行另一项任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25893437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com