SoapUI 提供了"运行测试用例功能":
https://www.soapui.org/docs/functional-testing/teststep-reference/run-testcase.html
问题是我不能只使用它来定位来自另一个测试套件的测试用例。
我知道我可以通过Groovy脚本来实现这一点,但我想使用图形界面。
有没有办法通过图形界面从另一个测试套件调用测试用例?
谢谢!
要在另一个项目中调用测试用例,您必须使用 Groovy 测试步骤。假设您的项目位于同一工作区中,则可以使用:
def workspace = testRunner.testCase.testSuite.project.workspace
def testCase = workspace
.getProjectByName("Sample SOAP Project Core")
.getTestSuiteByName("Simple TestSuite")
.getTestCaseByName("Simple Search TestCase")
def properties = new com.eviware.soapui.support.types.StringToObjectMap ()
testCase.run(properties, false)
我使用了 soapUI 附带的示例项目。上面的代码存在于Sample REST Project
的测试用例中,并在Sample SOAP Project Core
中调用测试用例。
// 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())