gpt4 book ai didi

gradle - 需要通过有关Gradle脚本的指导来执行soapui项目xml和生成报告html

转载 作者:行者123 更新时间:2023-12-03 06:28:00 25 4
gpt4 key购买 nike

我有一个gradle脚本来执行一个SOAPUI测试套件。当前,失败的日志位于同一文件夹中。我想获得所有通过和失败
要在单独的文件夹中创建的日志。我也想有一个index.html之类的报告,以查看执行通过/失败报告。它是否创建任何testsuite.xml来存储每个测试用例(如ANT)的已通过和失败数据?
我不熟悉gradle。所以我需要一个好的gradle脚本来帮助我。下面给出了我当前的gradle脚本,该脚本仅执行一个测试套件:

class SoapUITask extends Exec {
String soapUIExecutable = '/SOAPUIpath/SoapUI-5.1.2/bin/testrunner.sh'
String soapUIArgs = ''
public SoapUITask(){
super()
this.setExecutable(soapUIExecutable)
//printReport=true

}
public void setSoapUIArgs(String soapUIArgs) {
this.args = "$soapUIArgs".trim().split(" ") as List
}
}
// execute SOAPUI
task executeSOAPUI(type: SoapUITask){
// simply pass the project path as argument,
// note that the extra " are needed
soapUIArgs = '/path/of/SOAPUI project xml/src/PCDEMO-soapui-project.xml'
}

最佳答案

如果要从SOAPUI documentation生成HTML报告,可以使用以下参数:

-f - Specifies the root directory, where the runner will save test result files. If the specified directory does not exist, it will be created.

-F Specifies the format of the exported reports. Usage: -F. Supported formats include PDF, XLS, HTML, RTF, CSV, TXT and XML. If the parameter is not specified, PDF is used. To export results in several formats, separate them with commas. For example, -FPDF,XML,CSV.



注意:正如您在文档中可以看到的那样,-F参数仅适用于PRO版本。如果您尝试使用-F参数时使用免费版本,则会得到以下输出:
org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -FPDF


因此,您可以修改 task executeSOAPUI以添加 -f location-FHTML,如下所示:

// execute SOAPUI
task executeSOAPUI(type: SoapUITask){
// simply pass the project path as argument,
// note that the extra " are needed
soapUIArgs = '-f "path/of/outputReports" -FHTML "/path/of/SOAPUI project xml/src/PCDEMO-soapui-project.xml"'
}

相反,如果您希望获得Junit Html样式报告,则可以尝试使用follow参数(也仅在PRO版本中可用):

-R - Specifies the type of the report data.

Usage: -R. Report type can be one of the following:

Project Report - Generates a report in the format that is specified by the -F argument. The runner will save the report files to the directory that the -f argument specifies. Depending on the -A argument value, the files can be organized into subdirectories.

TestSuite Report - As above, but for TestSuites.

TestCase Report - As above, but for TestCases.

JUnit-Style HTML Report - Generates a report as JUnit-style HTML files. See JUnit-Style HTML Reports. When this value is used, the runner ignores the -F and -A arguments.

Data Export - Generates XML files with report data. See Data Export. When you use this argument, -F must be XML or must not be specified.

Use the -f argument to specify the directory, where the runner will save generated report files.



使用此,您的 task可能是:

// execute SOAPUI
task executeSOAPUI(type: SoapUITask){
// simply pass the project path as argument,
// note that the extra " are needed
soapUIArgs = '-f "path/of/outputReports" -R"JUnit-Style HTML Report" "/path/of/SOAPUI project xml/src/PCDEMO-soapui-project.xml"'
}

免责声明:我没有PRO版本,因此无法测试答案中提供的任何选项。

关于gradle - 需要通过有关Gradle脚本的指导来执行soapui项目xml和生成报告html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35770615/

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