Forum Discussion

M1ke's avatar
M1ke
Occasional Contributor
8 years ago
Solved

learning how to Mock a service

hi guys,

 

As the title suggest, I'm trying to learn how to mock a service. And as a result, I am reading this tutorial on mocking a service.

 

Now, in the spirit of making sure I understand every single line, I came across a line in seciton 3, line 4 of the tutorial that reads: "After creating the MockService, you should get a MockService with one operation and one request".

 

Please SOAP UI gurus, where in navigator does it show 'one operation and one request"?

 

There's nothing in the script that suggest a particular code segment is an operation either.

 

Look forward to your responses.

  • Hi,

     

    I think they have made a mistake in their terminology in step 4. (that I think you are referring to) - They should say 'you should get one operation (ConversionRate) and one Response (Response 1) - not 'one request', as mocks don't make requests in SoapUI , they receive them and make responses (sometimes they may make custom requests in SoapUI using Groovy scripting).

     

    Does this make more sense?

     

    Regards,

    Rup 

9 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    I think they have made a mistake in their terminology in step 4. (that I think you are referring to) - They should say 'you should get one operation (ConversionRate) and one Response (Response 1) - not 'one request', as mocks don't make requests in SoapUI , they receive them and make responses (sometimes they may make custom requests in SoapUI using Groovy scripting).

     

    Does this make more sense?

     

    Regards,

    Rup 

    • M1ke's avatar
      M1ke
      Occasional Contributor

      Hi Rupert,

       

      Thank you very much. This clears it up.

       

      It appears simple things like that trips a SOAP UI newbie like myself.

       

      Again, much appreciated.

       

      Will be posting more questions as I go along. I sure hope I'm sending the mto the right place.

       

      Just a complimentary question. Can I confirm that an operation could have more than one response? I am asking because the response is numbered with a '1'.

       

      Personally, I dont see how this is logical. But figured I ask.

       

      Also, is your book SOAP UI Cookbook aimed at SOAP UI newbies?

       

      Kind regards,

      Michael

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi Michael,

         

        You're welcome, I like helping where I can, it can also help me think of new potential blog topics or enhancements for areas where people might value help.

         

        Whilst I ended up liking SoapUI, I must confess that I didn't find it intuitive or easy to figure out when I first tried to use it, so I think you aren't alone! :-)

         

        I would say this forum is the best place for questions like this - there are some nice topics / answers in here. Some people also use stack overflow, but I don't contribute there for SoapUI stuff.

         

        The practical answer to your question may soon present itself the further you go. One typical use of mocks in SoapUI is to despatch different responses based on the request e.g. mocking an error response based on certain request properties. Having the ability to add a range of responses allows people to easily add responses with different content. Take a look at the response (double click it) in your mock:

         

        Notice the dispatch type options and default response, these give useful ways to tell the mock which response to pick. The most powerful is the script type - we can cover that if you need it!

         

        Thanks for asking about my book. Whilst it is designed for intermediate SoapUI people, I tried to make most of the recipes complete worked examples, so I don't think you would have a problem making use of it. Its meant to complement the SoapUI wiki really, would love to know any feedback. Chapter 3 covers mocks. 

         

        Regards,

        Rup