Forum Discussion

richie's avatar
richie
Community Hero
4 years ago
Solved

Asynch Messaging Testing Help Please?

Hey!

 

I've got to test some asynch messaging (non-blocking communication) via Queues and there wont be any responses to assert against.

 

Before now, the way I've tested asynch messaging is one of the following 3 options.   

 

1. Read the message off the Queue to assert against (although I've never done this using ReadyAPI!, I used JMeter several years ago).

2. Query the underlying Queue table (using JDBC) where the message is persisted and assert against the record in the table (although I've never done this using ReadyAPI!, I used JMeter several years ago)

3.  Get Development to create some test stub APIs that hook into the genuine APIs.  These stub APIs provide the response I needed to assert against.

 

SO - Ive used option 3 within ReadyAPI! - but I've never used option 1 or 2 in ReadyAPI!.

 

Its likely I've got to do option 1 (Read off the Queue to prove content of message) or variations thereof in my new project going forward so I need to work out how to do this.

 

HOWEVER - I've been reading in the help to work out how to use ReadyAPI! to test asynch messaging - but I notice it keeps mentioning Mockservices, WebHooks - but I'm just not understanding the concept of either using webhooks to test asynch messaging nor the use of MockServices to test asynch messaging.

 

Can anyone please help out and explain what I'm totally not understanding.  there's a huge gap in my knowledge and reading the help isn't well... helping!

 

This link relates to MockServices for testing asynch messaging in ReadyAPI! - but I just dont understand why mocking a service would help the tester verify the content of the message that was published to the Queue.

 

This link relates to WebHooks, which seems to indicate webhooks wait for some event on an application or server - but I don't understand how this would help me verify a message on a Queue.   If a webhook is waiting for a particular event on a server - does this mean that a webhook could be setup to fire if an event of a message hitting a Queue occurred?  Is that what these webhooks are used for in regards to asynch messaging or does it mean something else?

 

Can anyone help explain what I'm completely missing?

 

Thanks so much - I really have no idea, so would welcome any/all advice/hints/tips - whatever...really! 🙂

 

cheers,

 

rich

 

3 Replies

  • richie's avatar
    richie
    Community Hero

    just an update.

     

    the following link discusses the Mockresponse test step and says it has 2 uses - 1 use being "

    • Testing of asynchronous processes - for example starting some kind of job with an initial RequestStep and then waiting for a notification before moving on"

    i still dont understand why you need mocks to test the genuine service - if i just setup a mock its not gonna test anything but the mock, right?  im missing something essential....

     

    ta

     

    rich

      • richie's avatar
        richie
        Community Hero

        Hey Nastya_Khovrina 

         

        Thanks for responding - it's Rabbit so I think it's AMQP  and ReadyAPI! has a plugin - but there's also some other asynch REST APIs also.

         

        I remember the JMS tech corner thingy the guys worked on cos I bookmarked it cos it looked so handy, although not applicable in my RabbitMQ case.

         

        I'm just kindof lost on why mocking is used - I don't understand the reason, or value of using a mock/virt/stub (or whatever you want to call it) when testing asynch.  With asynch you have essentially 3 options - you do get a response but not immediate (callback/webhook approach or the polling approach) or you don't get a response at all.

        I just don't understand how/why mocking is used in these scenarios.

         

        Anyway - cheers Nastya_Khovrina 

         

        rich