subs = prev.getSubResults()
;
counter = 1;
for(SampleResult sub: subs) {
mail = sub.getResponseDataAsString();
// do something here with your the e-mail if you wish
// or put it into variable for further processing
vars.put("prefix_"+Integer.toString(counter),mail);
counter++;
}
If you put e-mail to variables prefix_# you can use ForEach Controller to process e-mail. For example you test plan may look as follows:
ForEach Controller should be configured as follows:
Remember to check Add "_" before number, because in the code there was underscore after ther prefix. And you can use ${mail} to access mail body or
mail = vars.get("mail");
in BeanShell.What I had to do was to extract URL from confirmation e-mail and pick up the process from where it has been interrupted. So, I have extracted urls in BeanShell Postprocessor and put them into variables rather than whole e-mail.
Happy testing.
Janek
This comment has been removed by the author.
ReplyDeletehi,
ReplyDeleteI also need to extract an URL from a confirmation e-mail. But I'm having some trouble figuring it out. It looks like Jmeter is not executing my Beanshell PostProcessor. Are there any configuration options that I need to keep in mind?
Kind Regards
Valérie