简体   繁体   English

测试与测试之间的区别

[英]Difference between Test and test in sbt

For example i can write in my build: 例如,我可以写我的构建:

name in Test := "some name"
name in test := "some name"

and both would perfectly work. 两者都完美无缺。 So what's the difference between them? 那么它们之间的区别是什么?

In the first case Test is of type configuration. 在第一种情况下, Test是类型配置。 As it is sad in the official docs to sbt: 正如官方文件中的令人遗憾的那样:

A configuration defines a flavor of build, potentially with its own classpath, sources, generated packages, etc. 

and the second test is just a simple task defined in the global scope. 第二个test只是在全局范围内定义的一个简单任务。 If you call inspect test in sbt it will show that test just executes all tests and is provided by global scope *:test , it's like an aggregator of all test tasks. 如果在sbt中调用inspect test ,它将显示test执行所有测试并由全局范围*:test ,它就像是所有测试任务的聚合器。 The whole task tree under test you can see with inspect tree task command. 您可以使用inspect tree task命令查看正在测试的整个任务树。 To inspect Test configuration you should call inspect test:configuration , as you can see it just provides configuration for test scope in your project. 要检查Test配置,您应该调用inspect test:configuration ,因为您可以看到它只是为项目中的测试范围提供配置。 So name in test and name in Test have the same result 因此name in test name in Test中的name in Test具有相同的结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM