Forum Discussion

Werner_Blueml's avatar
Werner_Blueml
Occasional Contributor
15 years ago

Problem with two MockResponse Steps in one TestCase

Hi All,

Is it possible to have 2 MockResponse Steps in one Testcase running on same path and port ?

MyTestCase
 Test Steps (6)
TestData Testdata for the Testcase
getUserByKey Request 1
getUserById Request 2
Loop Data Process next DataRow (getUserByKey)
Mock getUserByKey Response for getUserByKey, StartStep = getUserByKey
Mock getUserById Response for getUserById, StartStep =  getUserById



URL for Request's:
Request 1 : "http://127.0.0.1:9080/userService"
Request 2 : "http://127.0.0.1:9080/userService"

Path and Port for MockResponseSteps:
Mock getUserByKey --> Path "/userService", Port "9080"
Mock getUserById  --> Path "/userService", Port "9080"

With this configuration the Testcase didn't work. The request didn't arrive at the MockResponse Step and the following response is send.

Response for Request 2:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>Server</faultcode>
         <faultstring xml:lang="?">org.apache.xmlbeans.XmlException: error: Unexpected end of file after null</faultstring>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>



When I change the Ports for 2nd Request to 9090 it works!

URL for Request's:
Request 1 : "http://127.0.0.1:9080/userService"
Request 2 : "http://127.0.0.1:9090/userService"

Path and Port for MockResponseSteps:
Mock getUserByKey --> Path "/userService", Port "9080"
Mock getUserById  --> Path "/userService", Port "9090"


What can I do to use the same port?

Regards Werner

2 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Werner,

    hmm.. can you attach your project so I can debug?

    Are you using the latest nightly build or a release version?

    regards!

    /Ole
    eviware.com
  • Werner_Blueml's avatar
    Werner_Blueml
    Occasional Contributor
    Hi Ole,

    I've found a way to solve the problem ...
    I use Mockservice on the project level with special response depending on Request via QUERY_MATCH in the MockService.

    Thanks and regards
    Werner