我正在尝试运行一组特定的junit测试,使用Serenity框架提供的“WithTagValuesOf”注释。
基于Serenity教程,我可以为Maven找到相同的内容如下:
mvn clean verify -Dtags="release:sprint-2"但我正试图为Gradle找到一种类似的方法。前任:
gradle clean test --tests -Dtags="Test-Type:Smoke" aggregate上面的内容给出了以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [tags=Test-Type:Smoke]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED有人能帮我吗?
发布于 2016-09-15 15:48:33
我一贴出这个问题(我的坏处)就找到了答案。
我对为JBehave实现提供了类似问题的解决方案进行了调整。感谢Shawn的参考C84J
下面是我添加到构建文件中的代码。
build.gradle:
task copyPropsFile << {
if(!project.hasProperty('environment')){
ext.environment = 'dev'
}
copy{
from '../conf/' + environment + '/properties/serenity.properties'
into projectDir
}
if (project.hasProperty('tags')) {
println "JUnit tags set to: $tags"
ant.propertyfile(file: "$projectDir/serenity.properties") {
entry(key: "tags", value: "$tags")
}
}
}
// Hook into the gradle processTestResources task to execute the copyPropsFile custom task
processTestResources{
doFirst{
copyPropsFile.execute()
}
}最后,我使用
gradle clean test aggregate -Ptags="Test-Type:Smoke"https://stackoverflow.com/questions/39515033
复制相似问题