You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by Gero Vermaas <gv...@xebia.com> on 2011/12/01 12:29:56 UTC

How to create new Listener and use it from JMeter

Hi,

I want to extend JMeter such that I can catch the SampleResults and write
them to a file (in a slightly different format than done by the standard
elements). For that I implemented the SampleListener interface, created a
jar and dropped the jar in the lib/ext directory. However, the question now
is how do I include/register/... this new Listener in my testplan such that
the results can be written?

It has to be run in command line mode so, creating a GUI component to catch
the listener events is not really an option.

http://www.jajakarta.org/jmeter/1.7/en/extending/index.html#listener does
not have the complete instructions and I could not find a working example
 so far.

Any suggestions are welcome.

Thanks,
Gero

Re: How to create new Listener and use it from JMeter

Posted by sebb <se...@gmail.com>.
On 1 December 2011 11:29, Gero Vermaas <gv...@xebia.com> wrote:
> Hi,
>
> I want to extend JMeter such that I can catch the SampleResults and write
> them to a file (in a slightly different format than done by the standard
> elements). For that I implemented the SampleListener interface, created a
> jar and dropped the jar in the lib/ext directory. However, the question now
> is how do I include/register/... this new Listener in my testplan such that
> the results can be written?
>
> It has to be run in command line mode so, creating a GUI component to catch
> the listener events is not really an option.
>
> http://www.jajakarta.org/jmeter/1.7/en/extending/index.html#listener does

That website is seriously out of date (and nothing to do with the ASF)

Have you looked at the Extending link on the main JMeter site
http://jmeter.apache.org/ ?

http://jmeter.apache.org/extending/jmeter_tutorial.pdf

> not have the complete instructions and I could not find a working example
>  so far.
>
> Any suggestions are welcome.

Since the GUI is used to create test plans and configure test
elements, you need to create a minimal GUI.

Otherwise, you will have to edit the JMX file to add the appropriate
entries by hand, which will be hard work.

> Thanks,
> Gero

Re: How to create new Listener and use it from JMeter

Posted by sebb <se...@gmail.com>.
On 1 December 2011 14:21, Gero Vermaas <gv...@xebia.com> wrote:
> Seb,
>
> Thanks for the quick response. I did check that site also. The PDF mainly
> focusses on adding the GUI and I managed to do that by adding a subclass
> of AbstractVisualizer and I can select that from JMeter GUI. I can then
> receive the SampleResults in via the add(SampleResult sr) method and
> intended to use a ResultCollector (slightly modified) to store the results.
> However, when adding (modified) SampleResults to  the
> getModel().sampleOccurred() method nothing gets stored.
>
> How can I hook into the ResourceCollector to store the (modified)
> SampleResults to a file that I specified?

Have a look at how ResultSaver does it.
That works in non-GUI mode.

> Regards,
> Gero
>
> On Thu, Dec 1, 2011 at 1:20 PM, sebb <se...@gmail.com> wrote:
>
>> On 1 December 2011 11:29, Gero Vermaas <gv...@xebia.com> wrote:
>> > Hi,
>> >
>> > I want to extend JMeter such that I can catch the SampleResults and write
>> > them to a file (in a slightly different format than done by the standard
>> > elements). For that I implemented the SampleListener interface, created a
>> > jar and dropped the jar in the lib/ext directory. However, the question
>> now
>> > is how do I include/register/... this new Listener in my testplan such
>> that
>> > the results can be written?
>> >
>> > It has to be run in command line mode so, creating a GUI component to
>> catch
>> > the listener events is not really an option.
>> >
>> > http://www.jajakarta.org/jmeter/1.7/en/extending/index.html#listenerdoes
>>
>> That website is seriously out of date (and nothing to do with the ASF)
>>
>> Have you looked at the Extending link on the main JMeter site
>> http://jmeter.apache.org/ ?
>>
>> http://jmeter.apache.org/extending/jmeter_tutorial.pdf
>>
>> > not have the complete instructions and I could not find a working example
>> >  so far.
>> >
>> > Any suggestions are welcome.
>>
>> Since the GUI is used to create test plans and configure test
>> elements, you need to create a minimal GUI.
>>
>> Otherwise, you will have to edit the JMX file to add the appropriate
>> entries by hand, which will be hard work.
>>
>> > Thanks,
>> > Gero
>>

Re: How to create new Listener and use it from JMeter

Posted by Gero Vermaas <gv...@xebia.com>.
Thanks, that put me on the right track.

Gero

On Thu, Dec 1, 2011 at 3:38 PM, sebb <se...@gmail.com> wrote:

> On 1 December 2011 14:21, Gero Vermaas <gv...@xebia.com> wrote:
> > Seb,
> >
> > Thanks for the quick response. I did check that site also. The PDF mainly
> > focusses on adding the GUI and I managed to do that by adding a subclass
> > of AbstractVisualizer and I can select that from JMeter GUI. I can then
> > receive the SampleResults in via the add(SampleResult sr) method and
> > intended to use a ResultCollector (slightly modified) to store the
> results.
> > However, when adding (modified) SampleResults to  the
> > getModel().sampleOccurred() method nothing gets stored.
> >
> > How can I hook into the ResourceCollector to store the (modified)
> > SampleResults to a file that I specified?
>
> Have a look at how ResultSaver does it.
> That works in non-GUI mode.
>
> > Regards,
> > Gero
> >
> > On Thu, Dec 1, 2011 at 1:20 PM, sebb <se...@gmail.com> wrote:
> >
> >> On 1 December 2011 11:29, Gero Vermaas <gv...@xebia.com> wrote:
> >> > Hi,
> >> >
> >> > I want to extend JMeter such that I can catch the SampleResults and
> write
> >> > them to a file (in a slightly different format than done by the
> standard
> >> > elements). For that I implemented the SampleListener interface,
> created a
> >> > jar and dropped the jar in the lib/ext directory. However, the
> question
> >> now
> >> > is how do I include/register/... this new Listener in my testplan such
> >> that
> >> > the results can be written?
> >> >
> >> > It has to be run in command line mode so, creating a GUI component to
> >> catch
> >> > the listener events is not really an option.
> >> >
> >> >
> http://www.jajakarta.org/jmeter/1.7/en/extending/index.html#listenerdoes
> >>
> >> That website is seriously out of date (and nothing to do with the ASF)
> >>
> >> Have you looked at the Extending link on the main JMeter site
> >> http://jmeter.apache.org/ ?
> >>
> >> http://jmeter.apache.org/extending/jmeter_tutorial.pdf
> >>
> >> > not have the complete instructions and I could not find a working
> example
> >> >  so far.
> >> >
> >> > Any suggestions are welcome.
> >>
> >> Since the GUI is used to create test plans and configure test
> >> elements, you need to create a minimal GUI.
> >>
> >> Otherwise, you will have to edit the JMX file to add the appropriate
> >> entries by hand, which will be hard work.
> >>
> >> > Thanks,
> >> > Gero
> >>
>

Re: How to create new Listener and use it from JMeter

Posted by Gero Vermaas <gv...@xebia.com>.
Seb,

Thanks for the quick response. I did check that site also. The PDF mainly
focusses on adding the GUI and I managed to do that by adding a subclass
of AbstractVisualizer and I can select that from JMeter GUI. I can then
receive the SampleResults in via the add(SampleResult sr) method and
intended to use a ResultCollector (slightly modified) to store the results.
However, when adding (modified) SampleResults to  the
getModel().sampleOccurred() method nothing gets stored.

How can I hook into the ResourceCollector to store the (modified)
SampleResults to a file that I specified?

Regards,
Gero

On Thu, Dec 1, 2011 at 1:20 PM, sebb <se...@gmail.com> wrote:

> On 1 December 2011 11:29, Gero Vermaas <gv...@xebia.com> wrote:
> > Hi,
> >
> > I want to extend JMeter such that I can catch the SampleResults and write
> > them to a file (in a slightly different format than done by the standard
> > elements). For that I implemented the SampleListener interface, created a
> > jar and dropped the jar in the lib/ext directory. However, the question
> now
> > is how do I include/register/... this new Listener in my testplan such
> that
> > the results can be written?
> >
> > It has to be run in command line mode so, creating a GUI component to
> catch
> > the listener events is not really an option.
> >
> > http://www.jajakarta.org/jmeter/1.7/en/extending/index.html#listenerdoes
>
> That website is seriously out of date (and nothing to do with the ASF)
>
> Have you looked at the Extending link on the main JMeter site
> http://jmeter.apache.org/ ?
>
> http://jmeter.apache.org/extending/jmeter_tutorial.pdf
>
> > not have the complete instructions and I could not find a working example
> >  so far.
> >
> > Any suggestions are welcome.
>
> Since the GUI is used to create test plans and configure test
> elements, you need to create a minimal GUI.
>
> Otherwise, you will have to edit the JMX file to add the appropriate
> entries by hand, which will be hard work.
>
> > Thanks,
> > Gero
>