You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Andrey Simonov <au...@bk.ru> on 2009/08/17 09:38:59 UTC

Output to Tree View Listener

Hello,

Could you please tell me, how can I output certain messages to Tree View
Listener?

I need to do the the following:

If {variable} is > 5 then Output "Timeout expired"

Maybe this can be done into another listener, but anyway, how do I output
message into JMeter?

Thank you.
-- 
View this message in context: http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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: Output to Tree View Listener

Posted by Adrian Speteanu <as...@gmail.com>.
Hi Andrey,

I know this might be confusing when first starting to use jmeter, so I
think a beginners' advice might be of more use:

>From your question I assume you want to check if an action doesn't
receive a slow answer and fail it if so. Use this:
- sampler
   |- duration assertion
Assertions cover a lot, in general, they are very useful for such validations.

But if you want to get information from the test in general, not just
to fail the sampler, there are plenty ways to do it:

1. when you need to see the value of a variable at a certain step in
the test plan: add a debug sampler immediately after the step where
the variable is used / extracted etc. it will show in the results tree
and you can see there if the values are as expected (only use this to
check if your test plan does what you want it to... remove such
samplers during performance testing).

2. if you just want to check automatically stuff during the test, you
use the if controller and add whatever message you like in the title
of a dummy sampler (just as sebb indicated). for example:
  - sampler #12
      \-> regex to variable with name valueExtracted
  - if '${valueExtracted}' != '<expectedValue>'
      \-> dummySampler #1 with name : 'ERROR : sampler #12 failed to
contain expected output. Value was acctually ${valueExtracted}'. -
create the dummy sampler with a path that cannot exist in your project
and/or is not valid SO THE SAMPLER FAILS no matter what and thus it
will immediately show between green test samples when looking at the
results tree (easier to find and has no effect on the server). this is
the simplest way to output something to be visible.

3. if you don't want to have failed samples in the Results tree, you
can also add information you want to read in the headers of the next
sampler (http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Header_Manager
you will need to add a header manager as a child to that sampler).
 - sampler 1
   \-> regex -> variable
 - sampler 2
   \-> http headers manager
        + add a line with no name and value ${variable}
Because the server doesn't expect such a header information, it will
probably ignore it (but you need to make sure that it has no negative
effect). In the results tree you will find this information in the
Sampler Results tab in the Response headers section.

>From what I know, there is no way to specifically "print" something -
the results tree has a completely different use, but you can use all
sorts of tricks to get what you need. There is a function that allows
one to add information in the logs (I never used it). Depends on what
you need this for.


On Wed, Aug 26, 2009 at 12:14 PM, sebb<se...@gmail.com> wrote:
> On 26/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>>
>>  Solution is not found so far...
>>
>>
>>  So, how can I output some text into the Tree View?
>>
>>  I understand that "Listeners only show samples and Assertion failures."
>>
>>  So maybe I can create a BeanShell/Java sampler that will output my text?
>>
>>  I'm confused on how to do it :(
>>
>
> As I already wrote:
>
> "either generate a dummy sample (e.g. using If Controller and Java
> Request) or add an Assertion than fails when variable > 5 (e.g. using
> BeanShell or BSF Assertion)"
>
>>  Andrey Simonov wrote:
>>  >
>>
>> > Solution found for assertion:
>>
>> >
>>  > 1. Mentioned above obvious 'dummy sample' method
>>  > 2. BeanShell Assertion:
>>  >
>>  > if (Integer.parseInt(vars.get("AA")) < 30) {
>>  > Failure=true;
>>  > }
>>  >
>>  > Where AA is a JMeter variable.
>>  >
>>  >
>>  > sebb-2-2 wrote:
>>  >>
>>  >> On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>>  >>>
>>  >>>  Hello,
>>  >>>
>>  >>>  Could you please tell me, how can I output certain messages to Tree
>>  >>> View
>>  >>>  Listener?
>>  >>>
>>  >>>  I need to do the the following:
>>  >>>
>>  >>>  If {variable} is > 5 then Output "Timeout expired"
>>  >>>
>>  >>>  Maybe this can be done into another listener, but anyway, how do I
>>  >>> output
>>  >>>  message into JMeter?
>>  >>
>>  >> Listeners only show samples and Assertion failures.
>>  >>
>>  >> So either generate a dummy sample (e.g. using If Controller and Java
>>  >> Request) or add an Assertion than fails when variable > 5 (e.g. using
>>  >> BeanShell or BSF Assertion)
>>  >>
>>  >>>  Thank you.
>>  >>>
>>  >>> --
>>  >>>  View this message in context:
>>  >>> http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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/Output-to-Tree-View-Listener-tp25002377p25148488.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
>
>

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


Re: Output to Tree View Listener

Posted by sebb <se...@gmail.com>.
On 26/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>
>  Solution is not found so far...
>
>
>  So, how can I output some text into the Tree View?
>
>  I understand that "Listeners only show samples and Assertion failures."
>
>  So maybe I can create a BeanShell/Java sampler that will output my text?
>
>  I'm confused on how to do it :(
>

As I already wrote:

"either generate a dummy sample (e.g. using If Controller and Java
Request) or add an Assertion than fails when variable > 5 (e.g. using
BeanShell or BSF Assertion)"

>  Andrey Simonov wrote:
>  >
>
> > Solution found for assertion:
>
> >
>  > 1. Mentioned above obvious 'dummy sample' method
>  > 2. BeanShell Assertion:
>  >
>  > if (Integer.parseInt(vars.get("AA")) < 30) {
>  > Failure=true;
>  > }
>  >
>  > Where AA is a JMeter variable.
>  >
>  >
>  > sebb-2-2 wrote:
>  >>
>  >> On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>  >>>
>  >>>  Hello,
>  >>>
>  >>>  Could you please tell me, how can I output certain messages to Tree
>  >>> View
>  >>>  Listener?
>  >>>
>  >>>  I need to do the the following:
>  >>>
>  >>>  If {variable} is > 5 then Output "Timeout expired"
>  >>>
>  >>>  Maybe this can be done into another listener, but anyway, how do I
>  >>> output
>  >>>  message into JMeter?
>  >>
>  >> Listeners only show samples and Assertion failures.
>  >>
>  >> So either generate a dummy sample (e.g. using If Controller and Java
>  >> Request) or add an Assertion than fails when variable > 5 (e.g. using
>  >> BeanShell or BSF Assertion)
>  >>
>  >>>  Thank you.
>  >>>
>  >>> --
>  >>>  View this message in context:
>  >>> http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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/Output-to-Tree-View-Listener-tp25002377p25148488.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: Output to Tree View Listener

Posted by sebb <se...@gmail.com>.
On 26/08/2009, Deepak Shetty <sh...@gmail.com> wrote:
> Hi
>  create a BeanShell Sampler
>  Sample code below
>
>  ResponseCode=200;
>  ResponseMessage="This is some message"; -->This shows in sampler result tab
>  IsSuccess=true;
>  SampleResult.setResponseData("This is some ResponseData"); --> This shows in
>  Response data tab
>
>  http://jakarta.apache.org/jmeter/api/org/apache/jmeter/samplers/SampleResult.html--
>  for the API

Or just use the Java Request / JavaTest Sampler, as mentioned previously:

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Java_Request


>  regards
>
> deepak
>
>
>  On Wed, Aug 26, 2009 at 1:12 AM, Andrey Simonov <au...@bk.ru> wrote:
>
>  >
>  > So, how can I output some text into the Tree View?
>  >
>  > I understand that "Listeners only show samples and Assertion failures."
>  >
>  > So maybe I can create a BeanShell/Java sampler that will output my text?
>  >
>  > I'm confused on how to do it :(
>  >
>  >
>  > Andrey Simonov wrote:
>  > >
>  > > Solution found:
>  > >
>  > > 1. Mentioned above obvious 'dummy sample' method
>  > > 2. BeanShell Assertion:
>  > >
>  > > if (Integer.parseInt(vars.get("AA")) < 30) {
>  > > Failure=true;
>  > > }
>  > >
>  > > Where AA is a JMeter variable.
>  > >
>  > >
>  > > sebb-2-2 wrote:
>  > >>
>  > >> On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>  > >>>
>  > >>>  Hello,
>  > >>>
>  > >>>  Could you please tell me, how can I output certain messages to Tree
>  > >>> View
>  > >>>  Listener?
>  > >>>
>  > >>>  I need to do the the following:
>  > >>>
>  > >>>  If {variable} is > 5 then Output "Timeout expired"
>  > >>>
>  > >>>  Maybe this can be done into another listener, but anyway, how do I
>  > >>> output
>  > >>>  message into JMeter?
>  > >>
>  > >> Listeners only show samples and Assertion failures.
>  > >>
>  > >> So either generate a dummy sample (e.g. using If Controller and Java
>  > >> Request) or add an Assertion than fails when variable > 5 (e.g. using
>  > >> BeanShell or BSF Assertion)
>  > >>
>  > >>>  Thank you.
>  > >>>
>  > >>> --
>  > >>>  View this message in context:
>  > >>>
>  > http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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/Output-to-Tree-View-Listener-tp25002377p25148488.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: Output to Tree View Listener

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
create a BeanShell Sampler
Sample code below

ResponseCode=200;
ResponseMessage="This is some message"; -->This shows in sampler result tab
IsSuccess=true;
SampleResult.setResponseData("This is some ResponseData"); --> This shows in
Response data tab

http://jakarta.apache.org/jmeter/api/org/apache/jmeter/samplers/SampleResult.html--
for the API

regards
deepak

On Wed, Aug 26, 2009 at 1:12 AM, Andrey Simonov <au...@bk.ru> wrote:

>
> So, how can I output some text into the Tree View?
>
> I understand that "Listeners only show samples and Assertion failures."
>
> So maybe I can create a BeanShell/Java sampler that will output my text?
>
> I'm confused on how to do it :(
>
>
> Andrey Simonov wrote:
> >
> > Solution found:
> >
> > 1. Mentioned above obvious 'dummy sample' method
> > 2. BeanShell Assertion:
> >
> > if (Integer.parseInt(vars.get("AA")) < 30) {
> > Failure=true;
> > }
> >
> > Where AA is a JMeter variable.
> >
> >
> > sebb-2-2 wrote:
> >>
> >> On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
> >>>
> >>>  Hello,
> >>>
> >>>  Could you please tell me, how can I output certain messages to Tree
> >>> View
> >>>  Listener?
> >>>
> >>>  I need to do the the following:
> >>>
> >>>  If {variable} is > 5 then Output "Timeout expired"
> >>>
> >>>  Maybe this can be done into another listener, but anyway, how do I
> >>> output
> >>>  message into JMeter?
> >>
> >> Listeners only show samples and Assertion failures.
> >>
> >> So either generate a dummy sample (e.g. using If Controller and Java
> >> Request) or add an Assertion than fails when variable > 5 (e.g. using
> >> BeanShell or BSF Assertion)
> >>
> >>>  Thank you.
> >>>
> >>> --
> >>>  View this message in context:
> >>>
> http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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/Output-to-Tree-View-Listener-tp25002377p25148488.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: Output to Tree View Listener

Posted by Andrey Simonov <au...@bk.ru>.
So, how can I output some text into the Tree View?

I understand that "Listeners only show samples and Assertion failures."

So maybe I can create a BeanShell/Java sampler that will output my text?

I'm confused on how to do it :(


Andrey Simonov wrote:
> 
> Solution found:
> 
> 1. Mentioned above obvious 'dummy sample' method
> 2. BeanShell Assertion:
> 
> if (Integer.parseInt(vars.get("AA")) < 30) {
> Failure=true;
> }
> 
> Where AA is a JMeter variable.
> 
> 
> sebb-2-2 wrote:
>> 
>> On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>>>
>>>  Hello,
>>>
>>>  Could you please tell me, how can I output certain messages to Tree
>>> View
>>>  Listener?
>>>
>>>  I need to do the the following:
>>>
>>>  If {variable} is > 5 then Output "Timeout expired"
>>>
>>>  Maybe this can be done into another listener, but anyway, how do I
>>> output
>>>  message into JMeter?
>> 
>> Listeners only show samples and Assertion failures.
>> 
>> So either generate a dummy sample (e.g. using If Controller and Java
>> Request) or add an Assertion than fails when variable > 5 (e.g. using
>> BeanShell or BSF Assertion)
>> 
>>>  Thank you.
>>>
>>> --
>>>  View this message in context:
>>> http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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/Output-to-Tree-View-Listener-tp25002377p25148488.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: Output to Tree View Listener

Posted by Andrey Simonov <au...@bk.ru>.
Hi sebb,

Thank you for your answer!

Could you please give me an example on how to do it:

> add an Assertion than fails when variable > 5 (e.g. using
> BeanShell or BSF Assertion)

or point me to a site where I can find such examples?



sebb-2-2 wrote:
> 
> On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>>
>>  Hello,
>>
>>  Could you please tell me, how can I output certain messages to Tree View
>>  Listener?
>>
>>  I need to do the the following:
>>
>>  If {variable} is > 5 then Output "Timeout expired"
>>
>>  Maybe this can be done into another listener, but anyway, how do I
>> output
>>  message into JMeter?
> 
> Listeners only show samples and Assertion failures.
> 
> So either generate a dummy sample (e.g. using If Controller and Java
> Request) or add an Assertion than fails when variable > 5 (e.g. using
> BeanShell or BSF Assertion)
> 
>>  Thank you.
>>
>> --
>>  View this message in context:
>> http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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/Output-to-Tree-View-Listener-tp25002377p25005185.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: Output to Tree View Listener

Posted by sebb <se...@gmail.com>.
On 17/08/2009, Andrey Simonov <au...@bk.ru> wrote:
>
>  Hello,
>
>  Could you please tell me, how can I output certain messages to Tree View
>  Listener?
>
>  I need to do the the following:
>
>  If {variable} is > 5 then Output "Timeout expired"
>
>  Maybe this can be done into another listener, but anyway, how do I output
>  message into JMeter?

Listeners only show samples and Assertion failures.

So either generate a dummy sample (e.g. using If Controller and Java
Request) or add an Assertion than fails when variable > 5 (e.g. using
BeanShell or BSF Assertion)

>  Thank you.
>
> --
>  View this message in context: http://www.nabble.com/Output-to-Tree-View-Listener-tp25002377p25002377.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