Mahsum Akbas avatar

BeanShell Assertion for multiple sub-results in JMeter

mahsumakbas

Published: 10 Aug 2018 › Updated: 10 Aug 2018BeanShell Assertion for multiple sub-results in JMeter

BeanShell Assertion for multiple sub-results in JMeter

You can use standard "Response Assertion" or other CSS or XPath assertions to check your JMeter requests' responses.

But, if there are situations such redirection, there will multiple responses for each request. In case of you need to check all that sub results, standard assertions can't provide any easy solution.

An optimized solution is to use BeanShell Assertion:

Subresults = SampleResult.getSubResults();
int numOfsubResult = Subresults.length;

print("Num of sub results: " + numOfsubResult);

for(int i =0; i<numOfsubResult; i++){
    print(Subresults[i].getResponseCode());
    print(Subresults[i].getURL().getPath());
    print(Subresults[i].getUrlAsString());
}


Leave BeanShell Assertion for multiple sub-results in JMeter to:

Written by

Digital Nomad - Yazılım Uzmanı, Yeni Medya insanı/korsanı, Gezgin, Hikaye anlatıcısı/yazarı // Software Engineer, Digital Pirate, Traveller, Storyteller/writer

Read more #technology posts


Best Posts From Mahsum Akbas

We have not curated any of mahsumakbas's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Mahsum Akbas