首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如何在soap ui for Project中使用groovy创建摘要报告

在SOAP UI项目中使用Groovy创建摘要报告的步骤如下:

  1. 打开SOAP UI项目并选择要创建摘要报告的测试套件。
  2. 在测试套件的右侧面板中,选择“Test Case”选项卡。
  3. 在“Test Case”选项卡中,选择要创建摘要报告的测试用例。
  4. 在测试用例的右侧面板中,选择“Test Step”选项卡。
  5. 在“Test Step”选项卡中,选择要创建摘要报告的测试步骤。
  6. 在测试步骤的右侧面板中,选择“Script”选项卡。
  7. 在“Script”选项卡中,选择Groovy脚本编辑器。
  8. 在Groovy脚本编辑器中,编写以下代码来创建摘要报告:
代码语言:txt
复制
import com.eviware.soapui.model.testsuite.TestRunner.Status

def testStep = testRunner.testCase.getTestStepByName("YourTestStepName")
def status = testStep.testRequest.response.status

if (status == Status.FAILED) {
    log.error("Test Step failed: " + testStep.name)
} else if (status == Status.CANCELED) {
    log.warn("Test Step canceled: " + testStep.name)
} else {
    log.info("Test Step passed: " + testStep.name)
}

def summaryReport = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testRunner.testCase, null)
summaryReport.runTestStepByName("YourTestStepName")

def summary = summaryReport.getSummary()
def totalTests = summary.getTestCount()
def failedTests = summary.getFailedCount()
def canceledTests = summary.getCanceledCount()
def successRate = (totalTests - failedTests - canceledTests) / totalTests * 100

log.info("Summary Report:")
log.info("Total Tests: " + totalTests)
log.info("Failed Tests: " + failedTests)
log.info("Canceled Tests: " + canceledTests)
log.info("Success Rate: " + successRate + "%")

请注意替换代码中的"YourTestStepName"为您要创建摘要报告的测试步骤的名称。

  1. 点击Groovy脚本编辑器中的“运行”按钮来执行脚本。
  2. 在SOAP UI的日志面板中,您将看到摘要报告的输出,包括总测试数、失败测试数、取消测试数和成功率。

这样,您就可以在SOAP UI项目中使用Groovy创建摘要报告了。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

领券