0
votes

Is it possible to have Jmeter return the final results of a set of HTTP request responses to a webhook URL?

For example: I have a mini Journey created with several HTTP request / responses. The final HTTP request response body is retrieved using getResponsesData and using PostProcessor Groovy, I determine whether test passed or failed. I like to integrate that with webhook url how can I do that?

1

1 Answers

1
votes

JMeter is built around Apache HttpComponents therefore you can invoke a HTTP Request directly from Groovy code using Apache HttpClient, something like:

import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.HttpClients
import org.apache.http.util.EntityUtils

def httpClient = HttpClients.createDefault()
def httpGet = new HttpGet("http://example.com")
def response = httpClient.execute(httpGet)
//do what you need with the response, i.e. print it to jmeter.log
log.info(EntityUtils.toString(response.getEntity()))

response.close()
httpClient.close()

Check out Sending HTTP and HTTPS Requests Using Groovy in JMeter for comprehensive information and advanced scenarios examples