You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Tong Sun <su...@gmail.com> on 2020/12/30 15:40:30 UTC

Mark error in JSR223 steps

Hi,

My JSR223 steps have problems, some even have exceptions, but viewing
from View Result Tree, they are all green and correct.

How to mark those JSR223 steps that have problems red and failed?

I tried to throw an exception, but that killed the whole thread.

thx

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


Re: Mark error in JSR223 steps

Posted by Felix Schumacher <fe...@internetallee.de>.
Have you tried the simplest test plan you can imagine? Can you post it here?

Felix

Am 30. Dezember 2020 21:45:51 MEZ schrieb Tong Sun <su...@gmail.com>:
>Hmm,
>
>I've put
>
>SampleResult.with {
>successful = false
>responseCode = "500"
>responseMessage = "some error...."
>}
>
>into my catch section, but they are still green and correct (even
>error is caught) viewed in Result Tree.
>
>I also tried to use
>
>SampleResult.setSuccessful(false)
>
>but that didn't work either -- itself generated another exception.
>
>So do I have to `new` a SampleResult before making use of the class?
>If so, how can JMeter know to use my own newed SampleResult as the
>result?
>
>On Wed, Dec 30, 2020 at 12:02 PM Tong Sun <su...@gmail.com> wrote:
>>
>> Thanks a lot Mariusz, I could never come up with answers like that
>myself!
>>
>> On Wed, Dec 30, 2020 at 11:50 AM Mariusz W <ma...@gmail.com> wrote:
>> >
>> > To see it in reports and listeners:
>> > SampleResult.with {
>> > successful = false
>> > responseCode = "500"
>> > responseMessage = "some error...."
>> > }
>> >
>> > Regards,
>> > Mariusz
>> >
>> > On Wed, 30 Dec 2020 at 16:40, Tong Sun <su...@gmail.com>
>wrote:
>> >
>> > > Hi,
>> > >
>> > > My JSR223 steps have problems, some even have exceptions, but
>viewing
>> > > from View Result Tree, they are all green and correct.
>> > >
>> > > How to mark those JSR223 steps that have problems red and failed?
>> > >
>> > > I tried to throw an exception, but that killed the whole thread.
>> > >
>> > > thx
>> > >
>> > >
>---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> > > For additional commands, e-mail: user-help@jmeter.apache.org
>> > >
>> > >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>For additional commands, e-mail: user-help@jmeter.apache.org

Re: Mark error in JSR223 steps

Posted by Tong Sun <su...@gmail.com>.
Hmm,

I've put

SampleResult.with {
successful = false
responseCode = "500"
responseMessage = "some error...."
}

into my catch section, but they are still green and correct (even
error is caught) viewed in Result Tree.

I also tried to use

SampleResult.setSuccessful(false)

but that didn't work either -- itself generated another exception.

So do I have to `new` a SampleResult before making use of the class?
If so, how can JMeter know to use my own newed SampleResult as the result?

On Wed, Dec 30, 2020 at 12:02 PM Tong Sun <su...@gmail.com> wrote:
>
> Thanks a lot Mariusz, I could never come up with answers like that myself!
>
> On Wed, Dec 30, 2020 at 11:50 AM Mariusz W <ma...@gmail.com> wrote:
> >
> > To see it in reports and listeners:
> > SampleResult.with {
> > successful = false
> > responseCode = "500"
> > responseMessage = "some error...."
> > }
> >
> > Regards,
> > Mariusz
> >
> > On Wed, 30 Dec 2020 at 16:40, Tong Sun <su...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > My JSR223 steps have problems, some even have exceptions, but viewing
> > > from View Result Tree, they are all green and correct.
> > >
> > > How to mark those JSR223 steps that have problems red and failed?
> > >
> > > I tried to throw an exception, but that killed the whole thread.
> > >
> > > thx
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > > For additional commands, e-mail: user-help@jmeter.apache.org
> > >
> > >

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


Re: Mark error in JSR223 steps

Posted by Tong Sun <su...@gmail.com>.
Thanks a lot Mariusz, I could never come up with answers like that myself!

On Wed, Dec 30, 2020 at 11:50 AM Mariusz W <ma...@gmail.com> wrote:
>
> To see it in reports and listeners:
> SampleResult.with {
> successful = false
> responseCode = "500"
> responseMessage = "some error...."
> }
>
> Regards,
> Mariusz
>
> On Wed, 30 Dec 2020 at 16:40, Tong Sun <su...@gmail.com> wrote:
>
> > Hi,
> >
> > My JSR223 steps have problems, some even have exceptions, but viewing
> > from View Result Tree, they are all green and correct.
> >
> > How to mark those JSR223 steps that have problems red and failed?
> >
> > I tried to throw an exception, but that killed the whole thread.
> >
> > thx
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > For additional commands, e-mail: user-help@jmeter.apache.org
> >
> >

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


Re: Mark error in JSR223 steps

Posted by Mariusz W <ma...@gmail.com>.
To see it in reports and listeners:
SampleResult.with {
successful = false
responseCode = "500"
responseMessage = "some error...."
}

Regards,
Mariusz

On Wed, 30 Dec 2020 at 16:40, Tong Sun <su...@gmail.com> wrote:

> Hi,
>
> My JSR223 steps have problems, some even have exceptions, but viewing
> from View Result Tree, they are all green and correct.
>
> How to mark those JSR223 steps that have problems red and failed?
>
> I tried to throw an exception, but that killed the whole thread.
>
> thx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: Mark error in JSR223 steps

Posted by Tong Sun <su...@gmail.com>.
Thanks Felix
I've been banning my head on the wall for a few days.
Thanks for helping & resolving the issue.

Happy New Year!

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


Re: Mark error in JSR223 steps

Posted by Felix Schumacher <fe...@internetallee.de>.
Am 30.12.20 um 16:40 schrieb Tong Sun:
> Hi,
>
> My JSR223 steps have problems, some even have exceptions, but viewing
> from View Result Tree, they are all green and correct.
>
> How to mark those JSR223 steps that have problems red and failed?
>
> I tried to throw an exception, but that killed the whole thread.

That "killing the whole" thread can be configured on the Thread Group.
If you configured "Action to be taken after a Sample Error" to something
starting with "Stop", JMeter will kill threads with Sample errors.

If you mark your samples as failed, JMeter will take the action you
configured.

You have to decide, whether you want JMeter to stop on failure or not.
If you want to let it stop, you have to make sure, that you don't mark
any samples as failed. If you want to let JMeter to continue, you can
use the default behaviour of the JSR223 Sampler, which is to convert
exceptions into failed samples.

Felix

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

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


Re: Mark error in JSR223 steps

Posted by Mark Miller <ma...@gmail.com>.
When you are using a JSR 223 sampler, you are in full programmatic control
of the sample and its result.

I find it most helpful to get right into the JavaDocs for, in this case,
the SampleResult:
https://jmeter.apache.org/api/index.html?org/apache/jmeter/samplers/SampleResult.html

From your description, it sounds like some exception handling and explicit
setting of your result state will help. For example, see `setSuccessful`.

I hope that helps.

On Wed, Dec 30, 2020 at 8:40 AM Tong Sun <su...@gmail.com> wrote:

> Hi,
>
> My JSR223 steps have problems, some even have exceptions, but viewing
> from View Result Tree, they are all green and correct.
>
> How to mark those JSR223 steps that have problems red and failed?
>
> I tried to throw an exception, but that killed the whole thread.
>
> thx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

-- 
Mark Miller