Search code examples
soapui

How to pass arguments to soapui test case from another test case which using Run Test Case step


Using soapui open source edition. I know this question is very basic, but somehow missing something and not able to pass argument value to template test case.

There are multiple test steps in a test case. And there are multiple tests with different data. So, this can be done in different ways. And I am trying the 2nd approach. Also looked at the soapui's documentation, nothing has mentioned something like this.

  1. Create test case with all the steps required. Clone test case for number of times and change the data. Which is not smart way.
  2. Create one test case, name it as basicTestCaseTemplate. Assume it has 3 soap request steps and each request is using a property and use property expansion instead of static test values such as ${#TestCase#ID}. Then use the above template case in different test cases using a test step called Run Test Case, passing value of ID from here. However, value ID is not being passed to requests of templateTestCase. Basically wanted to reuse the test steps. Any ideas?

Please note that I can use groovy step instead of Run Test Case as alternative like the documentation says. But I think, this is something very basic and should work or doing some trival mistake.


Solution

  • Maybe is something related with your SOAPUI version, I try to reproduce your problem using SOAPUI 5.0.0, so I create a TestSuite which contains two TestCases.

    In the first TestCase I simply add a Test Step SOAP Request which in his request it use as you comment the follow property using property expansion ${#TestCase#ID}. Also I add on the Custom Properties tab of this Test Case the ID property with original ID as value :

    enter image description here

    In the second TestCase I create a Run TestCase step, and there I specify the template TestCase as a TestCase to run. Automatically this TestStep recognize the TestCase ID property and allows me to assign a different value for it in this context:

    enter image description here

    Now If I run the Run TestCase in the http log tab I can see the request with the modified ID:

    Wed May 04 13:24:15 CEST 2016:DEBUG:>> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:oasis:names:tc:dss:1.0:profiles:archive">[\n]"
    Wed May 04 13:24:15 CEST 2016:DEBUG:>> "   <soapenv:Body>[\n]"
    Wed May 04 13:24:15 CEST 2016:DEBUG:>> "   [0x9]different ID from Run TestCase step[\n]"
    Wed May 04 13:24:15 CEST 2016:DEBUG:>> "   </soapenv:Body>[\n]"
    Wed May 04 13:24:15 CEST 2016:DEBUG:>> "</soapenv:Envelope>"
    

    Note: Seems that if you don't explicitly add the property on Custom property tab of the template TestCase, the Run TestCase step don't give you the option to set the property value (even if you're using the property expansion on the request). I think that your problem could be on this.

    Hope it helps,