Forum Discussion

Mamalazer's avatar
Mamalazer
New Contributor
3 years ago
Solved

Get property from test case in mock script assertion(SOAP)

Hello. How can i get property from test case in mock script assertion?

I try to use:

 

1) def groovycase = testRunner.testCase.getPropertyValue("propcase")

2) def testCase = messageExchange.modelItem.testCase;
    def expected = testCase.getPropertyValue("propcase");

 

but it doesn't work because i get error. 

 

 
 
 
 
 
  • Just think of it. If you are running the test against real services, will the real service know anything about its client or invoker? Answer is "No". Iisn't?

    Similarly mock service doen't know either about the client.
    If the service needs any information, that has to be available either in the request or in the headers.
    If you need some value and it is not part of payload or something, you can optionally pass the value in the custom header and access the same customer header in the mock service. Of the same header will be available in the real service too.

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Just think of it. If you are running the test against real services, will the real service know anything about its client or invoker? Answer is "No". Iisn't?

    Similarly mock service doen't know either about the client.
    If the service needs any information, that has to be available either in the request or in the headers.
    If you need some value and it is not part of payload or something, you can optionally pass the value in the custom header and access the same customer header in the mock service. Of the same header will be available in the real service too.