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<[email protected]> wrote:
> On 26/08/2009, Andrey Simonov <[email protected]> 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 <[email protected]> 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: [email protected]
>>  >>>  For additional commands, e-mail: [email protected]
>>  >>>
>>  >>>
>>  >>
>>  >> ---------------------------------------------------------------------
>>  >> To unsubscribe, e-mail: [email protected]
>>  >> For additional commands, e-mail: [email protected]
>>  >>
>>  >>
>>  >>
>>  >
>>  >
>>
>>  --
>>  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: [email protected]
>>  For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to