gpt4 book ai didi

scala - sbt:如何运行集成测试

转载 作者:行者123 更新时间:2023-12-04 02:52:50 25 4
gpt4 key购买 nike

根据documentation :

The standard testing tasks are available, but must be prefixed with it:. For example,

> IntegrationTest / testOnly org.example.AnIntegrationTest



如上所述,我将此添加到我的 build.sbt :
lazy val server = (project in file("server"))
.configs(IntegrationTest)

我只想运行集成测试。

所以我尝试了不同的方法 - 但都没有奏效:
[IJ][play-binding-form-server] $ it:test
[error] No such setting/task
[error] it:test
...
[IJ][play-binding-form-server] $ IntegrationTest / testOnly org.example.AnIntegrationTest
[error] Expected whitespace character
[error] Expected '/'
[error] IntegrationTest / testOnly org.example.AnIntegrationTest

它是如何正确完成的?

最佳答案

您需要启用 settings(Defaults.itSettings)像这儿

lazy val server = (project in file("server"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)

在此之后,您应该能够在 sbt 中运行两者
sbt> it:testOnly test.Spec
sbt> IntegrationTest / testOnly test.Spec

或在 sbt 之外作为
sbt "it:testOnly test.Spec"
sbt "IntegrationTest / testOnly test.Spec"

关于scala - sbt:如何运行集成测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54251069/

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