You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Lyle <ly...@cubic.com> on 2012/10/25 00:55:13 UTC

Re: exiting with an error return code when Assertion Test fails

No responses, so maybe a little more information would help.

I started out writing a Nagios plugin script that did wget's of our website,
and grep'ing the html for expected results.  By keeping track of cookies, I
was able to log in, query some of my account details, etc.  Both wget and
grep return suitable error codes, so the plugin can return a 0(OK),
1(Warning), or 2(Critical), along with some explanatory text, to Nagios, and
the process works well.

But as our website functional monitoring needs got more involved, I looked
for a better tool, and was pointed to JMeter.

JMeter is certainly better at developing the test using a web proxy, vs
writing the wget calls by hand.  But I don't seem to be able to get an error
return code when running the test on the command line, even though I can see
the Assertion Test fail when run in the GUI.  I suppose I could save the XML
result from the JMeter run and grep it for results.

I've been told that JMeter, JUnit, etc are all meant to work with Maven and
will be equally disappointing for me.  Is JMeter the wrong tool for what I
need?  Any pointers to a better approach.  Can I somehow exit the JMeter
test with an error code when an Assertion Test fails (hope, hope).

Thanks...Lyle



--
View this message in context: http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: exiting with an error return code when Assertion Test fails

Posted by Shmuel Krakower <sh...@gmail.com>.
Hi,
I think you can use the "System.exit(ERROR_CODE);" inside a beanshell
sampler.

Best,
Shmuel Krakower.


On Thu, Oct 25, 2012 at 1:42 AM, Oliver Erlewein <ol...@erlewein.net>wrote:

> Isn't there an easier way? I'd just want to cal it in a shell script and
> get a return code. Maybe something for a future JMeter version?
>
> On 25 October 2012 12:04, Deepak Shetty <sh...@gmail.com> wrote:
>
> > oh and if you want the test to quit on failure(instead of running all the
> > tests) you use
> >
> http://jmeter.apache.org/usermanual/component_reference.html#Thread_Group
> > Stop test on failure
> >
> > You could also write custom listeners that can do whatever you want when
> > there is an error.
> > regards
> > deepak
> >
> > On Wed, Oct 24, 2012 at 4:02 PM, Deepak Shetty <sh...@gmail.com>
> wrote:
> >
> > > http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
> > > failureproperty
> > >
> > > (Not tested)
> > >
> > > regards
> > > deepak
> > >
> > >
> > > On Wed, Oct 24, 2012 at 3:55 PM, Lyle <ly...@cubic.com> wrote:
> > >
> > >> No responses, so maybe a little more information would help.
> > >>
> > >> I started out writing a Nagios plugin script that did wget's of our
> > >> website,
> > >> and grep'ing the html for expected results.  By keeping track of
> > cookies,
> > >> I
> > >> was able to log in, query some of my account details, etc.  Both wget
> > and
> > >> grep return suitable error codes, so the plugin can return a 0(OK),
> > >> 1(Warning), or 2(Critical), along with some explanatory text, to
> Nagios,
> > >> and
> > >> the process works well.
> > >>
> > >> But as our website functional monitoring needs got more involved, I
> > looked
> > >> for a better tool, and was pointed to JMeter.
> > >>
> > >> JMeter is certainly better at developing the test using a web proxy,
> vs
> > >> writing the wget calls by hand.  But I don't seem to be able to get an
> > >> error
> > >> return code when running the test on the command line, even though I
> can
> > >> see
> > >> the Assertion Test fail when run in the GUI.  I suppose I could save
> the
> > >> XML
> > >> result from the JMeter run and grep it for results.
> > >>
> > >> I've been told that JMeter, JUnit, etc are all meant to work with
> Maven
> > >> and
> > >> will be equally disappointing for me.  Is JMeter the wrong tool for
> > what I
> > >> need?  Any pointers to a better approach.  Can I somehow exit the
> JMeter
> > >> test with an error code when an Assertion Test fails (hope, hope).
> > >>
> > >> Thanks...Lyle
> > >>
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
> > >> Sent from the JMeter - User mailing list archive at Nabble.com.
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > >> For additional commands, e-mail: user-help@jmeter.apache.org
> > >>
> > >>
> > >
> >
>

Re: exiting with an error return code when Assertion Test fails

Posted by Deepak Shetty <sh...@gmail.com>.
I see that the ANT task does it by parsing the log file so it doesnt look
like there is an easier way

so yeah probably someone should raise an enhancement in bugzilla.


regards

deepak


On Oct 24, 2012 4:42 PM, "Oliver Erlewein" <ol...@erlewein.net> wrote:

> Isn't there an easier way? I'd just want to cal it in a shell script and
> get a return code. Maybe something for a future JMeter version?
>
> On 25 October 2012 12:04, Deepak Shetty <sh...@gmail.com> wrote:
>
> > oh and if you want the test to quit on failure(instead of running all the
> > tests) you use
> >
> http://jmeter.apache.org/usermanual/component_reference.html#Thread_Group
> > Stop test on failure
> >
> > You could also write custom listeners that can do whatever you want when
> > there is an error.
> > regards
> > deepak
> >
> > On Wed, Oct 24, 2012 at 4:02 PM, Deepak Shetty <sh...@gmail.com>
> wrote:
> >
> > > http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
> > > failureproperty
> > >
> > > (Not tested)
> > >
> > > regards
> > > deepak
> > >
> > >
> > > On Wed, Oct 24, 2012 at 3:55 PM, Lyle <ly...@cubic.com> wrote:
> > >
> > >> No responses, so maybe a little more information would help.
> > >>
> > >> I started out writing a Nagios plugin script that did wget's of our
> > >> website,
> > >> and grep'ing the html for expected results.  By keeping track of
> > cookies,
> > >> I
> > >> was able to log in, query some of my account details, etc.  Both wget
> > and
> > >> grep return suitable error codes, so the plugin can return a 0(OK),
> > >> 1(Warning), or 2(Critical), along with some explanatory text, to
> Nagios,
> > >> and
> > >> the process works well.
> > >>
> > >> But as our website functional monitoring needs got more involved, I
> > looked
> > >> for a better tool, and was pointed to JMeter.
> > >>
> > >> JMeter is certainly better at developing the test using a web proxy,
> vs
> > >> writing the wget calls by hand.  But I don't seem to be able to get an
> > >> error
> > >> return code when running the test on the command line, even though I
> can
> > >> see
> > >> the Assertion Test fail when run in the GUI.  I suppose I could save
> the
> > >> XML
> > >> result from the JMeter run and grep it for results.
> > >>
> > >> I've been told that JMeter, JUnit, etc are all meant to work with
> Maven
> > >> and
> > >> will be equally disappointing for me.  Is JMeter the wrong tool for
> > what I
> > >> need?  Any pointers to a better approach.  Can I somehow exit the
> JMeter
> > >> test with an error code when an Assertion Test fails (hope, hope).
> > >>
> > >> Thanks...Lyle
> > >>
> > >>
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
> > >> Sent from the JMeter - User mailing list archive at Nabble.com.
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > >> For additional commands, e-mail: user-help@jmeter.apache.org
> > >>
> > >>
> > >
> >
>

Re: exiting with an error return code when Assertion Test fails

Posted by Oliver Erlewein <ol...@erlewein.net>.
Isn't there an easier way? I'd just want to cal it in a shell script and
get a return code. Maybe something for a future JMeter version?

On 25 October 2012 12:04, Deepak Shetty <sh...@gmail.com> wrote:

> oh and if you want the test to quit on failure(instead of running all the
> tests) you use
> http://jmeter.apache.org/usermanual/component_reference.html#Thread_Group
> Stop test on failure
>
> You could also write custom listeners that can do whatever you want when
> there is an error.
> regards
> deepak
>
> On Wed, Oct 24, 2012 at 4:02 PM, Deepak Shetty <sh...@gmail.com> wrote:
>
> > http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
> > failureproperty
> >
> > (Not tested)
> >
> > regards
> > deepak
> >
> >
> > On Wed, Oct 24, 2012 at 3:55 PM, Lyle <ly...@cubic.com> wrote:
> >
> >> No responses, so maybe a little more information would help.
> >>
> >> I started out writing a Nagios plugin script that did wget's of our
> >> website,
> >> and grep'ing the html for expected results.  By keeping track of
> cookies,
> >> I
> >> was able to log in, query some of my account details, etc.  Both wget
> and
> >> grep return suitable error codes, so the plugin can return a 0(OK),
> >> 1(Warning), or 2(Critical), along with some explanatory text, to Nagios,
> >> and
> >> the process works well.
> >>
> >> But as our website functional monitoring needs got more involved, I
> looked
> >> for a better tool, and was pointed to JMeter.
> >>
> >> JMeter is certainly better at developing the test using a web proxy, vs
> >> writing the wget calls by hand.  But I don't seem to be able to get an
> >> error
> >> return code when running the test on the command line, even though I can
> >> see
> >> the Assertion Test fail when run in the GUI.  I suppose I could save the
> >> XML
> >> result from the JMeter run and grep it for results.
> >>
> >> I've been told that JMeter, JUnit, etc are all meant to work with Maven
> >> and
> >> will be equally disappointing for me.  Is JMeter the wrong tool for
> what I
> >> need?  Any pointers to a better approach.  Can I somehow exit the JMeter
> >> test with an error code when an Assertion Test fails (hope, hope).
> >>
> >> Thanks...Lyle
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
> >> Sent from the JMeter - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> >> For additional commands, e-mail: user-help@jmeter.apache.org
> >>
> >>
> >
>

Re: exiting with an error return code when Assertion Test fails

Posted by Deepak Shetty <sh...@gmail.com>.
oh and if you want the test to quit on failure(instead of running all the
tests) you use
http://jmeter.apache.org/usermanual/component_reference.html#Thread_Group
Stop test on failure

You could also write custom listeners that can do whatever you want when
there is an error.
regards
deepak

On Wed, Oct 24, 2012 at 4:02 PM, Deepak Shetty <sh...@gmail.com> wrote:

> http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
> failureproperty
>
> (Not tested)
>
> regards
> deepak
>
>
> On Wed, Oct 24, 2012 at 3:55 PM, Lyle <ly...@cubic.com> wrote:
>
>> No responses, so maybe a little more information would help.
>>
>> I started out writing a Nagios plugin script that did wget's of our
>> website,
>> and grep'ing the html for expected results.  By keeping track of cookies,
>> I
>> was able to log in, query some of my account details, etc.  Both wget and
>> grep return suitable error codes, so the plugin can return a 0(OK),
>> 1(Warning), or 2(Critical), along with some explanatory text, to Nagios,
>> and
>> the process works well.
>>
>> But as our website functional monitoring needs got more involved, I looked
>> for a better tool, and was pointed to JMeter.
>>
>> JMeter is certainly better at developing the test using a web proxy, vs
>> writing the wget calls by hand.  But I don't seem to be able to get an
>> error
>> return code when running the test on the command line, even though I can
>> see
>> the Assertion Test fail when run in the GUI.  I suppose I could save the
>> XML
>> result from the JMeter run and grep it for results.
>>
>> I've been told that JMeter, JUnit, etc are all meant to work with Maven
>> and
>> will be equally disappointing for me.  Is JMeter the wrong tool for what I
>> need?  Any pointers to a better approach.  Can I somehow exit the JMeter
>> test with an error code when an Assertion Test fails (hope, hope).
>>
>> Thanks...Lyle
>>
>>
>>
>> --
>> View this message in context:
>> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
>

Re: exiting with an error return code when Assertion Test fails

Posted by Deepak Shetty <sh...@gmail.com>.
http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
failureproperty

(Not tested)

regards
deepak

On Wed, Oct 24, 2012 at 3:55 PM, Lyle <ly...@cubic.com> wrote:

> No responses, so maybe a little more information would help.
>
> I started out writing a Nagios plugin script that did wget's of our
> website,
> and grep'ing the html for expected results.  By keeping track of cookies, I
> was able to log in, query some of my account details, etc.  Both wget and
> grep return suitable error codes, so the plugin can return a 0(OK),
> 1(Warning), or 2(Critical), along with some explanatory text, to Nagios,
> and
> the process works well.
>
> But as our website functional monitoring needs got more involved, I looked
> for a better tool, and was pointed to JMeter.
>
> JMeter is certainly better at developing the test using a web proxy, vs
> writing the wget calls by hand.  But I don't seem to be able to get an
> error
> return code when running the test on the command line, even though I can
> see
> the Assertion Test fail when run in the GUI.  I suppose I could save the
> XML
> result from the JMeter run and grep it for results.
>
> I've been told that JMeter, JUnit, etc are all meant to work with Maven and
> will be equally disappointing for me.  Is JMeter the wrong tool for what I
> need?  Any pointers to a better approach.  Can I somehow exit the JMeter
> test with an error code when an Assertion Test fails (hope, hope).
>
> Thanks...Lyle
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: exiting with an error return code when Assertion Test fails

Posted by Deepak Shetty <sh...@gmail.com>.
yes and no - a performance test should be a combination of functional tests
run in parallel and there really should be no need to duplicate your cases
(but it is true selenium is better for testing browser specific stuff and
selenium-grid exists)

On Wed, Oct 24, 2012 at 11:26 PM, Miel Donkers
<mi...@codecentric.nl>wrote:

> Dear Lyle,
>
> While there are some responses already on how to get an exit code with
> JMeter, I'm questioning whether JMeter is the best tool for what you are
> trying to accomplish.
>
> It seems to me you are running acceptance tests; testing the functionality
> of the web application you are developing. Now I don't know all the
> background details, but in general frameworks like Selenium are more suited
> for acceptance testing. They let you write tests in Java and give you a
> 'headless' browser so they can even execute JavaScript and keep track of
> cookies. This will better reflect the end-user perspective.
> While I happily use JMeter, I only use it for performance testing.
>
> Let me know if you're looking for more information.
>
> Regards,
> Miel
>
>
> On 25 October 2012 00:55, Lyle <ly...@cubic.com> wrote:
>
> > No responses, so maybe a little more information would help.
> >
> > I started out writing a Nagios plugin script that did wget's of our
> > website,
> > and grep'ing the html for expected results.  By keeping track of
> cookies, I
> > was able to log in, query some of my account details, etc.  Both wget and
> > grep return suitable error codes, so the plugin can return a 0(OK),
> > 1(Warning), or 2(Critical), along with some explanatory text, to Nagios,
> > and
> > the process works well.
> >
> > But as our website functional monitoring needs got more involved, I
> looked
> > for a better tool, and was pointed to JMeter.
> >
> > JMeter is certainly better at developing the test using a web proxy, vs
> > writing the wget calls by hand.  But I don't seem to be able to get an
> > error
> > return code when running the test on the command line, even though I can
> > see
> > the Assertion Test fail when run in the GUI.  I suppose I could save the
> > XML
> > result from the JMeter run and grep it for results.
> >
> > I've been told that JMeter, JUnit, etc are all meant to work with Maven
> and
> > will be equally disappointing for me.  Is JMeter the wrong tool for what
> I
> > need?  Any pointers to a better approach.  Can I somehow exit the JMeter
> > test with an error code when an Assertion Test fails (hope, hope).
> >
> > Thanks...Lyle
> >
> >
> >
> > --
> > View this message in context:
> >
> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
> > Sent from the JMeter - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > For additional commands, e-mail: user-help@jmeter.apache.org
> >
> >
>
>
> --
> *Miel Donkers | Agile Solution Developer*
> *
> codecentric nederland bv | Laan der Verenigde Naties 60 | 3314 DA Dordrecht
> | Netherlands
> tel: +31 (0) 78.6134.220 | mobiel: +31 (0) 6.511.977.38 |
> miel.donkers@codecentric.nl*
> *www.codecentric.nl | blog.codecentric.nl |
> @codecentric_nl<http://www.twitter.com/codecentric_nl>
>
> Meer over ons: codecentric nederland bv is Java Expertise partner, met
> focus op Applicatie Performance Management. We werken met een 100% Agile
> grondslag. Samen met onze duitse moederorganisatie zijn we 150 medewerkers
> sterk. We zijn partner voor veel bedrijven waar kwaliteit en vakkennis
> centraal staat. codecentric is als enige verkozen tot Solution Partner in
> CER voor Appdynamics <http://www.appdynamics.com/>.*
>
> Watch <http://www.appdynamics.com/player/whydemo.php> a 2-min video of
> AppDynamics | Download<
> http://www.appdynamics.com/products-free-download.php>AppDynamics
> Lite for free
>
> **
>

Re: exiting with an error return code when Assertion Test fails

Posted by Miel Donkers <mi...@codecentric.nl>.
Dear Lyle,

While there are some responses already on how to get an exit code with
JMeter, I'm questioning whether JMeter is the best tool for what you are
trying to accomplish.

It seems to me you are running acceptance tests; testing the functionality
of the web application you are developing. Now I don't know all the
background details, but in general frameworks like Selenium are more suited
for acceptance testing. They let you write tests in Java and give you a
'headless' browser so they can even execute JavaScript and keep track of
cookies. This will better reflect the end-user perspective.
While I happily use JMeter, I only use it for performance testing.

Let me know if you're looking for more information.

Regards,
Miel


On 25 October 2012 00:55, Lyle <ly...@cubic.com> wrote:

> No responses, so maybe a little more information would help.
>
> I started out writing a Nagios plugin script that did wget's of our
> website,
> and grep'ing the html for expected results.  By keeping track of cookies, I
> was able to log in, query some of my account details, etc.  Both wget and
> grep return suitable error codes, so the plugin can return a 0(OK),
> 1(Warning), or 2(Critical), along with some explanatory text, to Nagios,
> and
> the process works well.
>
> But as our website functional monitoring needs got more involved, I looked
> for a better tool, and was pointed to JMeter.
>
> JMeter is certainly better at developing the test using a web proxy, vs
> writing the wget calls by hand.  But I don't seem to be able to get an
> error
> return code when running the test on the command line, even though I can
> see
> the Assertion Test fail when run in the GUI.  I suppose I could save the
> XML
> result from the JMeter run and grep it for results.
>
> I've been told that JMeter, JUnit, etc are all meant to work with Maven and
> will be equally disappointing for me.  Is JMeter the wrong tool for what I
> need?  Any pointers to a better approach.  Can I somehow exit the JMeter
> test with an error code when an Assertion Test fails (hope, hope).
>
> Thanks...Lyle
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/exiting-with-an-error-return-code-when-Assertion-Test-fails-tp5715096p5715143.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>


-- 
*Miel Donkers | Agile Solution Developer*
*
codecentric nederland bv | Laan der Verenigde Naties 60 | 3314 DA Dordrecht
| Netherlands
tel: +31 (0) 78.6134.220 | mobiel: +31 (0) 6.511.977.38 |
miel.donkers@codecentric.nl*
*www.codecentric.nl | blog.codecentric.nl |
@codecentric_nl<http://www.twitter.com/codecentric_nl>

Meer over ons: codecentric nederland bv is Java Expertise partner, met
focus op Applicatie Performance Management. We werken met een 100% Agile
grondslag. Samen met onze duitse moederorganisatie zijn we 150 medewerkers
sterk. We zijn partner voor veel bedrijven waar kwaliteit en vakkennis
centraal staat. codecentric is als enige verkozen tot Solution Partner in
CER voor Appdynamics <http://www.appdynamics.com/>.*

Watch <http://www.appdynamics.com/player/whydemo.php> a 2-min video of
AppDynamics | Download<http://www.appdynamics.com/products-free-download.php>AppDynamics
Lite for free

**