需要通过指导Gradle脚本来执行soapui项目xmls并生成报告html [英] Need through guidance on Gradle script to execute soapui project xmls and generate report html

查看:177
本文介绍了需要通过指导Gradle脚本来执行soapui项目xmls并生成报告html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gradle脚本来执行一个SOAPUI测试套件。目前失败的日志来自同一个文件夹。我想获得所有的通行证和失败的
日志在单独的文件夹中创建。我也想要一个类似index.html的报告来查看执行通过/失败报告。它是否创建了任何testsuite.xml来存储每个测试用例的传递和失败数据,如ANT?
我对gradle不熟悉。所以我需要一个很好的Gradle脚本来帮助我解决这个问题。我的当前gradle脚本在下面给出,它只执行一个测试套件:
$ b

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

$ b public void setSoapUIArgs(String soapUIArgs){
this.args =$ soapUIArgs .trim()。split()as List
}
}
//执行SOAPUI
任务executeSOAPUI(类型:SoapUITask){
//简单地通过项目路径作为参数,
//注意额外的需要
soapUIArgs ='/ path / of / SOAPUI项目xml / src / PCDEMO-soapui-project.xml'
}


解决方案

您想要从 SOAPUI文档生成HTML报告,您可以使用以下参数:


-f - 指定运行程序将保存测试结果文件的根目录。如果指定的目录不存在,将创建



-F指定导出报告的格式。用法:-F。支持的格式包括PDF,XLS,HTML,RTF,CSV,TXT和XML。如果未指定参数,则使用PDF。以
导出多种格式的结果,用逗号分隔它们。以
为例,-FPDF,XML,CSV。

注意:正如你在文档中看到的 -F 参数仅适用于PRO版本。如果您在尝试使用 -F 参数时使用免费版本,您将获得后续输出:
org.apache.commons .cli.UnrecognizedOptionException:Unrecognized option:-FPDF



所以你可以修改任务executeSOAPUI 添加 -f位置 -FHTML ,如下所示:

//执行SOAPUI
任务executeSOAPUI(类型:SoapUITask){
//只需传递项目路径作为参数,
//注意额外的需要
soapUIArgs ='-fpath / of / outputReports-FHTML/ path / of / SOAPUI项目xml / src / PCDEMO-soapui- project.xml'
}

如果您希望获得Junit Html样式报告可以尝试使用跟随参数(该参数也仅适用于PRO版本):


-R - 指定报告数据的类型。

用法:-R。报告类型可以是以下之一:

项目报告 - 以由-F参数指定的格式生成报告。跑步者将报告文件保存到-f参数指定的目录中。根据-A参数值,这些文件可以被组织到子目录中


TestSuite报告 - 如上所述,但对于TestSuite。

TestCase报告 - 如上所述,但对于TestCases。

JUnit样式HTML报告 - 以JUnit样式的HTML文件生成报告。请参阅JUnit样式的HTML报告。当使用此值时,跑步者会忽略-F和-A参数。

数据导出 - 生成包含报告数据的XML文件。请参阅数据导出。当你使用这个参数时,-F必须是XML或者不能被指定。

使用-f参数指定目录,其中运行程序将
保存生成的报告文件。


使用这个任务可以是:

//执行SOAPUI
任务executeSOAPUI(类型:SoapUITask){
//只需传递项目路径作为参数,
//注意额外的需要
soapUIArgs ='-fpath / of / outputReports-RJUnit-Style HTML Report/ path / of / SOAPUI project xml / src / PCDEMO-soapui-project.xml'
}

免责声明:我没有PRO版本,所以我无法测试我在答案中给出的任何选项。


I have a gradle script to execute one one SOAPUI test suite. Currently the failed logs are coming in the same folder. I want to get all of the pass and failed logs to be created in separate folder. I want to have a index.html like report too to see the execution pass/fail reports. Does it create any testsuite.xml that stores the passed and failed data of each testcase like ANT? I am not familiar with gradle. So I need a good gradle script that can help me out of this. My current gradle script is given below that executes only one test suite:

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'
}

解决方案

If you want to generate and HTML report from SOAPUI documentation you can use the follow parameters:

-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.

Note: As you can see on documentation the -F parameter only works for PRO version. If you use the free version when you try to use -F parameter you'll get the follow ouput: org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -FPDF

So you can modify task executeSOAPUI to add -f location and -FHTML as follows:

// 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"'
}

If instead you are expecting a Junit Html style report you can try with the follow parameter (which is also only available in PRO version):

-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.

Using this your task could be:

// 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"'
}

Disclaimer: I don't have a PRO version so I can't test any of the options I give in the answer.

这篇关于需要通过指导Gradle脚本来执行soapui项目xmls并生成报告html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆