Mark error in JSR223 steps

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Mark error in JSR223 steps

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.

thx

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

Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Mark Miller
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Mark Miller
Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Mariusz W
In reply to this post by Tong Sun
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Tong Sun
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 <[hidden email]> 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 <[hidden email]> 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: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >

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

Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Tong Sun
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >

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

Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Felix Schumacher
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 <[hidden email]>:

>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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>
>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: [hidden email]
>> > > For additional commands, e-mail: [hidden email]
>> > >
>> > >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Felix Schumacher
In reply to this post by Tong Sun

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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

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

Reply | Threaded
Open this post in threaded view
|

Re: Mark error in JSR223 steps

Tong Sun
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: [hidden email]
For additional commands, e-mail: [hidden email]