Wenneguen
Wenneguen

Reputation: 3418

Calling a TestCase from another TestSuite in SoapUI

SoapUI provides the " Run TestCase feature " :

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

The problem is that I cannot only use it to target a TestCase from another TestSuite.

I know I can achieve this via Groovy scripting but I would like to use the graphical interface.

Is there a way to call a TestCase from another TestSuite via the graphical interface ?

Thank you!

Upvotes: 1

Views: 2164

Answers (2)

simon Lamer
simon Lamer

Reputation: 11

// 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())

Upvotes: 1

craigcaulfield
craigcaulfield

Reputation: 3538

To call a test case in another project, you'll have to use a Groovy test step. Assuming your projects are in the same workspace, you could use:

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)

I used the sample projects that came with soapUI. The above code lives in a test case in Sample REST Project and calls a test case in Sample SOAP Project Core.

Upvotes: 1

Related Questions