5 Replies Latest reply on Apr 10, 2014 5:48 AM by nilspreusker

    Arquillian extensions for Mock/Stub servers

    asotobu

      With the advent of Rest APIs a new group of test frameworks has appeared to test them. Testing Rest API from the point of view of producers are relatively easy, using for example arquillian-rest-extension. But from the point of view of consumer it is a bit hard because you need an stub that simulates the producer. It should be interesting to have this part of tests also integrated inside arquillian.

       

       

      For now we have seen three frameworks:

       

       

      Moco: https://github.com/dreamhead/moco

      Wiremock: http://wiremock.org/

      MockServer: http://www.mock-server.com/

       

       

      So let's start talking about which could be the first to be integrated, if we should integrate all of them, only one, ideas of what this extension should provide, ...

        • 1. Re: Arquillian extensions for Mock/Stub servers
          nilspreusker

          Hi,

           

          I'm dealing with exactly this use case right now. We have a bunch of war modules that each have a REST API. While the REST APIs are mostly used to expose functionality to the outside world, some of the modules also interact using REST. Now, we usually test the war modules individually but as soon as there is another module involved, which is accessed via it's REST API, it needs to be deployed and included in the test case. This is where i'd like to be able to mock the modules REST API. However, when I tried to use wire mock, I ran into dependency clashes with the class org.apache.http.impl.conn.DefaultClientConnectionOperator and I suppose there will be more.

           

          Is anybody interested in this or maybe even working on it or is there another solution within the arquillian framework that I might not be aware of?

           

          For now, I guess I'll just go for the integration test approach where I just deploy multiple modules.

           

          Cheers!

          Nils

          • 2. Re: Arquillian extensions for Mock/Stub servers
            asotobu

            Hi well I am developing arquillian/arquillian-extension-moco · GitHub which is an Arquillian extension for Moco dreamhead/moco · GitHub framework. Basically is an stub like Wirwmock. I think that for the end of this week I will have a first alpha version published so you can start using it. Also I think it is so interesting that you can start using it as soon as it is released because it is in this cases where you find some missing features and can be implemented so quickly.

             

            Has it sense to you  of releasing at the end of the week?

            • 3. Re: Arquillian extensions for Mock/Stub servers
              nilspreusker

              Hi and sorry for the late reply, the forum didn't want to let me post it for some reason...

               

              Anyway, that sounds great! I'd be interested to try your code! I might even be able to give you feedback right away because we just started a two week sprint and I can reserve some time to work on this next week.

               

              Cheers,

              Nils

              • 4. Re: Arquillian extensions for Mock/Stub servers
                asotobu

                Currently there is a problem with Netty integration and Containers. Basically when you shutdown Netty, some threads takes more time to dead and container logs some severe errors about possible memory leaks. Anyway I will release the first alpha version and warn this to users, and we will try to find a solution.

                 

                Thank you I will post here when I release the version.

                • 5. Re: Arquillian extensions for Mock/Stub servers
                  nilspreusker

                  Great, looking forwards to it!

                   

                  Thanks,

                  Nils