【发布时间】:2018-11-27 03:24:52
【问题描述】:
我是一名实习生,目前在一家大公司工作。
在我的测试自动化项目(github)中,同一个项目中有两个不同团队的两个测试,所以有两个 Cucumber JUnit 文件。我不知道如何分别运行,所以我搜索,我目前的做法是将它们拆分为两个 Gradle 任务。
task ivtTest() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'html:cucumber.html', '--plugin', 'pretty','--plugin', 'json:cucumber.json', '--glue', '<glue location>', '<feature file location>']
}
}
}
task svtTest() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'html:cucumber.html', '--plugin', 'pretty','--plugin', 'json:cucumber.json', '--glue', '<glue location>', '<feature file location>']
}
}
}
现在我需要将它与 Jenkins 集成。我在这里阅读了文档:Continuos Build - Cucumber。它的做法是:
node {
stage('Generate HTML report') {
cucumber buildStatus: 'UNSTABLE',
fileIncludePattern: '**/*.json',
trendsLimit: 10,
classifications: [
[
'key': 'Browser',
'value': 'Firefox'
]
]
}
}
我猜它运行 JUnit 文件?它没有显示使用 Gradle 任务的方法。
既然我有两个 JUnit,它会同时运行两个 JUnit 吗?有没有办法改用 Gradle 任务?
如果这是一个愚蠢的问题,我很抱歉。我对这一切还是陌生的。我没有在我的大学学习这个。
【问题讨论】:
标签: java jenkins gradle cucumber