Is there a Q&A board for asking questions on Azure load test? The Microsoft Q&A board for Azure load testing is dead.
I have several issues with my JMeter script that works well locally with no issues but chokes in Azure load test. The documentation is useless.
There are no examples / documentation on how to ensure that cookies are extracted and passed in with every subsequent request after logging in.
I have an HTTP cookie manager at the plan level in the JMX and that works great and I can test all areas of the website.
But since the cookie extraction doesn't work, I can't get past the login process in Azure load test. No help to be found anywhere.
I then wrote a preprocessor script to extract the cookie data manually from the Loginpage sample / subsamples and disabled the cookie manager. I added the extracted cookies from this code in the HTTP header manager at the plan level.
Again, it works fine in JMeter locally, but doesn't in Azure load test.
Any help will be appreciated. Thanks
import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
// Function to extract cookies from given sample result
def extractCookies(HTTPSampleResult sample) {
def foundCookies = false
def matcherSession = (sample.getResponseHeaders() =~ /Set-Cookie: Session=([^;]+)/)
if (matcherSession.find()) {
vars.put('SESSION_TOKEN', matcherSession.group(1))
foundCookies = true
}
def matcherAeon = (sample.getResponseHeaders() =~ /Set-Cookie: AeonAuthToken=([^;]+)/)
if (matcherAeon.find()) {
vars.put('AEON_TOKEN', matcherAeon.group(1))
foundCookies = true
}
return foundCookies
}
// First, try to extract cookies from the main sample
boolean foundInMainSample = extractCookies(prev)
// If not found in the main sample, check the sub-samples
if (!foundInMainSample) {
prev.getSubResults().each { subResult ->
if (subResult.getSampleLabel().equals("LoginPage-M-0")) {
if (extractCookies(subResult)) {
return // Exit loop once cookies are found
}
}
}
}
log.warn("+++++++++++++++++++++");
log.warn("SESSION_TOKEN: " + vars.get("SESSION_TOKEN"));
log.warn("AEON_TOKEN: " + vars.get("AEON_TOKEN"));
log.warn("+++++++++++++++++++++");