sbt:如何运行集成测试 [英] sbt: How to run integration test

查看:129
本文介绍了sbt:如何运行集成测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档:

标准测试任务可用,但必须前缀它:.例如,

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

>IntegrationTest/testOnly org.example.AnIntegrationTest

如上所述,我将其添加到了 build.sbt :

As described, I added this to my build.sbt:

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

我只想运行集成测试.

因此,我尝试了不同的方法-但没有一种方法有效

So I tried different ways - but none worked:

[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内同时运行

After this you should be able to run both within sbt

sbt> it:testOnly test.Spec
sbt> IntegrationTest / testOnly test.Spec

或在 sbt 之外为

sbt "it:testOnly test.Spec"
sbt "IntegrationTest / testOnly test.Spec"

这篇关于sbt:如何运行集成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆