当从 Intellij 或通过 gradle 在命令行上运行测试时,where 子句的测试用例不会被分解和命名
final static String artifact = 'artifact'
final static String version = '1.2.3'
def getLayoutSpecificPathHappyPath(
def platform, def expected) {
given:
when:
def result = artifactoryManager.getLayoutSpecificPath(
platform, artifact, version)
then:
result == expected
where:
platform | prefix | expected
'npm' | 'prefix' | "${artifact}/-"
'maven' | 'prefix' | "${artifact}/${version}"
结果
ArtifactoryManagerTest > getLayoutSpecificPathv2HappyPath FAILED
我想我的 gradle 文件中有一个设置可以防止打印案例数据,从而更容易查看哪个地方失败了。
您可以通过设置
TestLogging中的
displayGranularity
并启用相关事件的日志记录来控制细节。
要记录的事件的显示粒度。例如,如果设置为 0,则方法级事件将显示为“Test Run > Test Worker x > org.SomeClass > org.someMethod”。如果设置为 2,相同的事件将显示为“org.someClass > org.someMethod”。
tasks.test {
testLogging {
events ("passed", "skipped", "failed")
displayGranularity = 1
}
}