我试图确保我的ScalaCheck属性运行500次,而不是默认的100次,但我在配置时遇到了麻烦。
class BlockSpec extends Properties("BlockSpec") with BitcoinSLogger {
val myParams = Parameters.default.withMinSuccessfulTests(500)
override def overrideParameters(p: Test.Parameters) = myParams
property("Serialization symmetry") =
Prop.forAll(BlockchainElementsGenerator.block) { block =>
logger.warn("Hex:" + block.hex)
Block(block.hex) == block
}
}
然而,当我实际运行这个测试时,它只显示成功通过了100个测试
编辑:
$ sbt
[info] Loading project definition from /home/chris/dev/bitcoins-core/project
[info] Set current project to bitcoin-s-core (in build file:/home/chris/dev/bitcoins-core/)
> test-only *BlockSpec*
[info] + BlockSpec.Serialization symmetry: OK, passed 100 tests.
[info] Elapsed time: 1 min 59.775 sec
[info] ScalaCheck
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
[info] ScalaTest
[info] Run completed in 2 minutes.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
[success] Total time: 123 s, completed Aug 1, 2016 11:36:17 AM
>
我该如何将这笔钱转移到我的酒店?
3条答案
按热度按时间gab6jxml1#
据我所知,您可以在两个级别上指定测试参数,但它们似乎无法进行通信。
第一个选项是在属性中,正如您尝试做的那样:
只要你不对属性调用
.check
,这就不会有任何影响。可以从sbt shell调用,也可以直接在类中调用。现在,如果您希望在调用
sbt:test
目标时影响测试运行的数量,那么您似乎必须使用选项build.sbt
(取自here):bfrts1fy2#
相比覆盖任何类型的全局测试配置,肯定有一种更简单的方法可以实现这一点:
8yparm6h3#
我使用
munit
看起来有点不同。下面是对我有效的方法,