Forum Discussion

FlorianHeere's avatar
FlorianHeere
New Contributor
2 years ago

Access to result of API Connection Teststep of Kafka Subscribe

Hi,

I am currently trying to access the response of API Connection Teststep of Kafka Subscribe and cannot make it work.

In the assertion of the step itself I can see that it is getting a Data-Oject as expected. Now I want to use that event from kafka for further processing.

 

Tried it like this in a groovy script after the subscription teststep:

def response = context.expand( '${API Connection Subscribe}' );
log.info "response=$response";

Result of script is:

Wed Jul 19 20:05:25 CEST 2023: INFO: response=

Any idea?

Found some questions in the community with a result, but none of them did work.

 

Thanks for help, regards,

Florian Heere

  • nmrao's avatar
    nmrao
    Champion Level 3

    FlorianHeere ,

     

    Never used.

    Can you below please

    Add script assertion for API Connection Subscript test step with below and see?

    //This Script assertion of the API step itself
    log.info "response : ${messageExchange.responseContent}"

    :

     

    • FlorianHeere's avatar
      FlorianHeere
      New Contributor

      Hi Rao,

      it endet up in:

      Fri Jul 21 13:39:08 CEST 2023: INFO: response : null
      Fri Jul 21 13:39:08 CEST 2023: INFO: responseContentAsXml : null

       

      responseContent was not a valid attribute of messageExchange

      Regards,

      Florian

  • nmrao's avatar
    nmrao
    Champion Level 3

    FlorianHeere 

    Have you run the test step and script assertion separately? Hope you the test step.

     

    Can you please add the below statement to the above script as well and post the output?

    log.info messageExchange.getClass()