gpt4 book ai didi

gradle - cucumber 报告如何使用intelliJ中的gradle工作?

转载 作者:行者123 更新时间:2023-12-03 03:26:29 24 4
gpt4 key购买 nike

我想要一些非常漂亮的 cucumber 报告,例如(https://damienfremont.com/2016/05/09/how-to-cucumber-test-report-plugin-2-with-maven-and-java/与 cucumber 报告有关的最后一个报告)。

但是我无法让它顺利进行...
有人可以帮我吗?

这是我的gradle版本...我知道它一定是错误的...

    plugins {
id 'java'
id "com.github.spacialcircumstances.gradle-cucumber-reporting" version "0.1.2"
}

group 'Guru99 Bank'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile 'io.cucumber:cucumber-java:2.4.0'
testCompile 'io.cucumber:cucumber-junit:2.4.0'
compileOnly group: 'info.cukes', name: 'gherkin', version: '2.12.2'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.5.3'
testCompile group: 'net.sourceforge.cobertura', name: 'cobertura', version: '2.1.1'
compile group: 'io.cucumber', name: 'cucumber-html', version: '0.2.7'
compileOnly group: 'io.cucumber', name: 'cucumber-jvm-deps', version: '1.0.6'
compile group: 'net.masterthought', name: 'cucumber-reporting', version: '4.3.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
}

configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}

task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime +
sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber',
'src/test/resources/']
}
}

cucumberReports {
outputDir = file('path/for/generated/html')
buildId = '0'
reports = files('out/cucumber-report.json', 'out/test/cucumber-
json.json')
}
}

最佳答案

在Build.gradle中尝试-

task cucumber(type: JavaExec) {
dependsOn assemble, compileTestJava
systemProperty('envcu', System.properties['envcu'] ?: 'dev')
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty','--plugin','html:CucumberReports','--plugin', 'json:CucumberReports/report.json','--glue', 'CucumberTest', 'src/test/resources']
}

cucumberReports {
outputDir = file('CucumberReports')
buildId = '0'
reports = files('CucumberReports/report.json')
}

关于gradle - cucumber 报告如何使用intelliJ中的gradle工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54294025/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com