首页 > 解决方案 > 在 SoapUI 中从另一个 TestSuite 调用 TestCase

问题描述

SoapUI 提供了“运行测试用例功能”:

https://www.soapui.org/docs/functional-testing/teststep-reference/run-testcase.html

问题是我不能只用它来定位另一个TestSuite的TestCase。

我知道我可以通过 Groovy 脚本实现这一点,但我想使用图形界面。

有没有办法通过图形界面从另一个 TestSuite 调用 TestCase ?

谢谢!

标签: soapuitestcasetest-suite

解决方案


// Replace names of a project, test suite, case and step with those you need.

// Connecting to the test step in another project.
def prj = 
testRunner.testCase.testSuite.project.workspace.getProjectByName("ProjectName")
tCase = prj.testSuites['TestSuiteName'].testCases['TestCaseName']
tStep = tCase.getTestStepByName("TestStepName")

// Calling the test runner and checking if it can run the specified step.
def runner = tStep.run(testRunner, context)
log.info ("runner status ....... : " + runner.hasResponse())

推荐阅读