BeanShell Assertion for multiple sub-results in JMeter

in #technology6 years ago

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());
}


Sort:  

Upvoted....I'm begginer and I need help...will you???
Please upvote me!!!

You got a 12.53% upvote from @emperorofnaps courtesy of @mahsumakbas!

Want to promote your posts too? Send 0.05+ SBD or STEEM to @emperorofnaps to receive a share of a full upvote every 2.4 hours...Then go relax and take a nap!

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by MA from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Coin Marketplace

STEEM 0.36
TRX 0.12
JST 0.039
BTC 70223.87
ETH 3561.28
USDT 1.00
SBD 4.73