pme*_*pme 3 integration-testing scala sbt
According to the documentation:
The standard testing tasks are available, but must be prefixed with it:. For example,
> IntegrationTest / testOnly org.example.AnIntegrationTest
As described, I added this to my build.sbt
:
lazy val server = (project in file("server"))
.configs(IntegrationTest)
Run Code Online (Sandbox Code Playgroud)
我只想运行集成测试。
所以我尝试了不同的方法 - 但都没有奏效:
[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
Run Code Online (Sandbox Code Playgroud)
它是如何正确完成的?
你需要settings(Defaults.itSettings)
像这里一样启用
lazy val server = (project in file("server"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
Run Code Online (Sandbox Code Playgroud)
在此之后,您应该能够在 sbt 中运行两者
sbt> it:testOnly test.Spec
sbt> IntegrationTest / testOnly test.Spec
Run Code Online (Sandbox Code Playgroud)
或者在sbt
as之外
sbt "it:testOnly test.Spec"
sbt "IntegrationTest / testOnly test.Spec"
Run Code Online (Sandbox Code Playgroud)