Forum Discussion
Hi,
Ok, so it sounds like you are happy extracting the details you need from the request to the first operation.
But it sounds like you have separate mock services for each of the two operations e.g.
MockUnderwritingService.operation1
and
VerificationMockService.operation2
(not a single mock with two operations that need to shared the data, as I originally thought)
Is this the case? If so then the mocks need a shared place (that both mocks can access) to store the request details from operation1 so that operation2 can retrieve them. For this you could use a light-weight DB as mentioned before, or potentially store the data as properties on some other shared objects e.g. TestCase, TestSuite, Project (has potetntial concurrency risks mentioned previously).
For example if you use the HashMap, you would need to store it in a property stored against an object that both the mocks can see, not a particular mock's context, like I suggested before when I thought both operations were on the same mock service.
If this is the case and is helping then I can suggest more details.
Thanks,
Rupert
Thanks for your help, storing it as a property at project level seems to be the way forward. I'll look further into that and see if I can get something working to test it out.
- rupert_anderson9 years agoValued Contributor
No problem.
You can also set/get properties as SoapUI global properties e.g.
In your first mock set the name:
import com.eviware.soapui.SoapUI
SoapUI.globalProperties.setPropertyValue( "firstName", "john" )
and then in your second mock get the name:
import com.eviware.soapui.SoapUI
def firstName = SoapUI.globalProperties.getPropertyValue( "firstName")
Whilst this works and should do you, please beware the potential issues if you start calling the mocks from multiple threads / simultaneously.
Cheers,
Rup
Related Content
Recent Discussions
- 14 days agosmilnik