You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by yaroslav1 <sl...@yahoo.com> on 2008/12/30 21:13:45 UTC

how to "assert" "Mail Reader Sample"

>From 2.3.2 release notes I've found: "Individual mails are now added as
sub-samples. "

I'm using the sample and beanshell-assertion, but a result is arr=1 message
found (see code below)

byte [] arr = (byte[]) ResponseData ;
String str = new String(arr);
print ("arr=" + str);

result is: "arr=1 message found"

But this is "RespondData" from the mail-reader-sample.

I need a "RespondData" from "Message 1" sub-sample.

See images below.

How can I get it?

http://www.nabble.com/file/p21222518/Slava_ScreenShot015.jpg 


http://www.nabble.com/file/p21222518/Slava_ScreenShot016.jpg 

-- 
View this message in context: http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21222518.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: how to "assert" "Mail Reader Sample"

Posted by yaroslav1 <sl...@yahoo.com>.
Thx, sebb-2-2,

I must have added this line: "import
org.apache.jmeter.samplers.SampleResult;"

Thank you again.


sebb-2-2 wrote:
> 
> On 30/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>>
>>  Sorry, I'm not expert, but it gives me an error:
>>
>>  print("ResponseData=" . . . '' : Typed variable declaration : Class:
>>  SampleResult not found in namespace
> 
> Try adding:
> 
> import org.apache.jmeter.samplers.SampleResult;
> 
>>  when I entered the line (SampleResult[] results =
>> Response.getSubResults();)
>>  in beanshell script.
>>  Without the line - there is no error :(
>>
>>  Here is my full script:
>>  --------
>>  print("ctx.getPreviousResult=" + ctx.getPreviousResult());
>>  print("ResponseData=" + ResponseData);
>>  print ("ResponseCode=" + ResponseCode);
>>  print ("ResponseMessage=" + ResponseMessage);
>>  print ("ResponseHeader=" + ResponseHeader);
>>  print ("RequestHeaders=" + RequestHeaders);
>>  print ("SampleLabel=" + SampleLabel);
>>  print ("SampleData=" + SampleData);
>>  print ("ctx=" + ctx);
>>  print ("SampleResult=" + SampleResult);
>>  print ("vars=" + vars);
>>  print ("log=" + log);
>>
>>  byte [] arr = (byte[]) ResponseData;
>>
>>  SampleResult[] results = Response.getSubResults();
>>
> 
> Or try
> 
> results = Response.getSubResults();
> 
> then:
> 
> result1=results[0];
> 
>>
>>  String str = new String(arr);
>>
>> //String str1 = new String(results);
>>  print ("arr=" + str);
>>  //print ("arr1=" + str1);
>>  ------------
>>
>>
>>
>>
>>
>>  sebb-2-2 wrote:
>>  >
>>  > On 30/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>>  >>
>>  >>  From 2.3.2 release notes I've found: "Individual mails are now added
>> as
>>  >>  sub-samples. "
>>  >>
>>  >>  I'm using the sample and beanshell-assertion, but a result is arr=1
>>  >> message
>>  >>  found (see code below)
>>  >>
>>  >>  byte [] arr = (byte[]) ResponseData ;
>>  >>  String str = new String(arr);
>>  >>  print ("arr=" + str);
>>  >>
>>  >>  result is: "arr=1 message found"
>>  >>
>>  >>  But this is "RespondData" from the mail-reader-sample.
>>  >>
>>  >>  I need a "RespondData" from "Message 1" sub-sample.
>>  >>
>>  >>  See images below.
>>  >>
>>  >>  How can I get it?
>>  >
>>  > You'll need to look at the sub-samples using
>>  >
>>  > SampleResult[] results = Response.getSubResults();
>>  >
>>  >>  http://www.nabble.com/file/p21222518/Slava_ScreenShot015.jpg
>>  >>
>>  >>
>>  >>  http://www.nabble.com/file/p21222518/Slava_ScreenShot016.jpg
>>  >>
>>  >>
>>  >>  --
>>  >>  View this message in context:
>>  >>
>> http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21222518.html
>>  >>  Sent from the JMeter - User mailing list archive at Nabble.com.
>>  >>
>>  >>
>>  >> 
>> ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>  >>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>  >
>>  >
>>  >
>>
>>
>> --
>>  View this message in context:
>> http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21223210.html
>>
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21224523.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: how to "assert" "Mail Reader Sample"

Posted by sebb <se...@gmail.com>.
On 30/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>
>  Sorry, I'm not expert, but it gives me an error:
>
>  print("ResponseData=" . . . '' : Typed variable declaration : Class:
>  SampleResult not found in namespace

Try adding:

import org.apache.jmeter.samplers.SampleResult;

>  when I entered the line (SampleResult[] results = Response.getSubResults();)
>  in beanshell script.
>  Without the line - there is no error :(
>
>  Here is my full script:
>  --------
>  print("ctx.getPreviousResult=" + ctx.getPreviousResult());
>  print("ResponseData=" + ResponseData);
>  print ("ResponseCode=" + ResponseCode);
>  print ("ResponseMessage=" + ResponseMessage);
>  print ("ResponseHeader=" + ResponseHeader);
>  print ("RequestHeaders=" + RequestHeaders);
>  print ("SampleLabel=" + SampleLabel);
>  print ("SampleData=" + SampleData);
>  print ("ctx=" + ctx);
>  print ("SampleResult=" + SampleResult);
>  print ("vars=" + vars);
>  print ("log=" + log);
>
>  byte [] arr = (byte[]) ResponseData;
>
>  SampleResult[] results = Response.getSubResults();
>

Or try

results = Response.getSubResults();

then:

result1=results[0];

>
>  String str = new String(arr);
>
> //String str1 = new String(results);
>  print ("arr=" + str);
>  //print ("arr1=" + str1);
>  ------------
>
>
>
>
>
>  sebb-2-2 wrote:
>  >
>  > On 30/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>  >>
>  >>  From 2.3.2 release notes I've found: "Individual mails are now added as
>  >>  sub-samples. "
>  >>
>  >>  I'm using the sample and beanshell-assertion, but a result is arr=1
>  >> message
>  >>  found (see code below)
>  >>
>  >>  byte [] arr = (byte[]) ResponseData ;
>  >>  String str = new String(arr);
>  >>  print ("arr=" + str);
>  >>
>  >>  result is: "arr=1 message found"
>  >>
>  >>  But this is "RespondData" from the mail-reader-sample.
>  >>
>  >>  I need a "RespondData" from "Message 1" sub-sample.
>  >>
>  >>  See images below.
>  >>
>  >>  How can I get it?
>  >
>  > You'll need to look at the sub-samples using
>  >
>  > SampleResult[] results = Response.getSubResults();
>  >
>  >>  http://www.nabble.com/file/p21222518/Slava_ScreenShot015.jpg
>  >>
>  >>
>  >>  http://www.nabble.com/file/p21222518/Slava_ScreenShot016.jpg
>  >>
>  >>
>  >>  --
>  >>  View this message in context:
>  >> http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21222518.html
>  >>  Sent from the JMeter - User mailing list archive at Nabble.com.
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>
> --
>  View this message in context: http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21223210.html
>
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: how to "assert" "Mail Reader Sample"

Posted by yaroslav1 <sl...@yahoo.com>.
Sorry, I'm not expert, but it gives me an error: 

print("ResponseData=" . . . '' : Typed variable declaration : Class:
SampleResult not found in namespace

when I entered the line (SampleResult[] results = Response.getSubResults();)
in beanshell script.
Without the line - there is no error :(

Here is my full script:
--------
print("ctx.getPreviousResult=" + ctx.getPreviousResult());
print("ResponseData=" + ResponseData);
print ("ResponseCode=" + ResponseCode);
print ("ResponseMessage=" + ResponseMessage);
print ("ResponseHeader=" + ResponseHeader);
print ("RequestHeaders=" + RequestHeaders);
print ("SampleLabel=" + SampleLabel);
print ("SampleData=" + SampleData);
print ("ctx=" + ctx);
print ("SampleResult=" + SampleResult);
print ("vars=" + vars);
print ("log=" + log);

byte [] arr = (byte[]) ResponseData;

SampleResult[] results = Response.getSubResults();

String str = new String(arr);
//String str1 = new String(results);
print ("arr=" + str);
//print ("arr1=" + str1);
------------




sebb-2-2 wrote:
> 
> On 30/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>>
>>  From 2.3.2 release notes I've found: "Individual mails are now added as
>>  sub-samples. "
>>
>>  I'm using the sample and beanshell-assertion, but a result is arr=1
>> message
>>  found (see code below)
>>
>>  byte [] arr = (byte[]) ResponseData ;
>>  String str = new String(arr);
>>  print ("arr=" + str);
>>
>>  result is: "arr=1 message found"
>>
>>  But this is "RespondData" from the mail-reader-sample.
>>
>>  I need a "RespondData" from "Message 1" sub-sample.
>>
>>  See images below.
>>
>>  How can I get it?
> 
> You'll need to look at the sub-samples using
> 
> SampleResult[] results = Response.getSubResults();
> 
>>  http://www.nabble.com/file/p21222518/Slava_ScreenShot015.jpg
>>
>>
>>  http://www.nabble.com/file/p21222518/Slava_ScreenShot016.jpg
>>
>>
>>  --
>>  View this message in context:
>> http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21222518.html
>>  Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21223210.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: how to "assert" "Mail Reader Sample"

Posted by sebb <se...@gmail.com>.
On 30/12/2008, yaroslav1 <sl...@yahoo.com> wrote:
>
>  From 2.3.2 release notes I've found: "Individual mails are now added as
>  sub-samples. "
>
>  I'm using the sample and beanshell-assertion, but a result is arr=1 message
>  found (see code below)
>
>  byte [] arr = (byte[]) ResponseData ;
>  String str = new String(arr);
>  print ("arr=" + str);
>
>  result is: "arr=1 message found"
>
>  But this is "RespondData" from the mail-reader-sample.
>
>  I need a "RespondData" from "Message 1" sub-sample.
>
>  See images below.
>
>  How can I get it?

You'll need to look at the sub-samples using

SampleResult[] results = Response.getSubResults();

>  http://www.nabble.com/file/p21222518/Slava_ScreenShot015.jpg
>
>
>  http://www.nabble.com/file/p21222518/Slava_ScreenShot016.jpg
>
>
>  --
>  View this message in context: http://www.nabble.com/how-to-%22assert%22-%22Mail-Reader-Sample%22-tp21222518p21222518.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org