Bug 64581 - Allow SampleResult#setIgnore to influence behaviour on Sampler Error
Summary: Allow SampleResult#setIgnore to influence behaviour on Sampler Error
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.3
Hardware: All All
: P2 enhancement (vote)
Target Milestone: JMETER_5.4
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk, PatchAvailable
Depends on:
Blocks:
 
Reported: 2020-07-06 11:14 UTC by Philippe Mouawad
Modified: 2020-07-08 07:02 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2020-07-06 11:14:46 UTC
Hello,
In version 4.0 of JMeter this method was introduced:

    https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html#setIgnore--


The aim was to provide the ability to custom tester code (JSR Sampler, PostProcessor) to not emit the SampleResult to listeners.

The current implementation is not be fully ok.

Currently , due to this:
https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/threads/JMeterThread.java#L561

The SampleResult is not considered to decide on what to do:
https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/threads/JMeterThread.java#L586

Besides, currently this condition is useless so it will be fixed:

    https://github.com/apache/jmeter/blob/master/src/core/src/main/java/org/apache/jmeter/threads/JMeterThread.java#L574


This should be changed as user usually wants to influence whether we switch to next iteration, stop thread, test.

As a consequence, the enhancement will restrict this method to what its javadoc states:
- Don't sent 

To avoid breaking existing code relying on it and because it looks correct, if ignore is set, we will not run:
- Post Processor on it as it is not supposed to concern real request on which user would like to extract data from response
- Assertion on it as it is not supposed to concern real request on which user would like to check some content

Considering its use is for impacting algorithmic execution, it will be taken into account to:

- Decide what to do on Error ("Action to be taken after a Sampler error" in Thread Group)
- set JMeterThread.last_sample_ok
Comment 1 Philippe Mouawad 2020-07-06 11:36:55 UTC
https://github.com/apache/jmeter/pull/604
Comment 2 Philippe Mouawad 2020-07-08 07:02:54 UTC
pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 77e80e8  Bug 64581 - Allow SampleResult#setIgnore to influence behaviour on (#604)
77e80e8 is described below

commit 77e80e8a0c3d3ef6f408f6fefecc622a286b5ce5
Author: Philippe M <pmouawad@users.noreply.github.com>
AuthorDate: Wed Jul 8 08:59:50 2020 +0200

    Bug 64581 - Allow SampleResult#setIgnore to influence behaviour on (#604)

    Sampler Error

    Fix also misnamed lastSampleInError to lastSampleOk
    When SampleResult#isIgnore() is true, use is for impacting algorithmic
    execution, it will be taken into account to:

    - Decide what to do on Error ("Action to be taken after a Sampler error"
    in Thread Group)
    - set JMeterThread.last_sample_ok
---
 .../org/apache/jmeter/threads/JMeterThread.java    | 60 +++++++++++++---------
 xdocs/changes.xml                                  |  1 +
 xdocs/usermanual/component_reference.xml           |  7 +++
 3 files changed, 43 insertions(+), 25 deletions(-)
Comment 3 The ASF infrastructure team 2022-09-24 20:38:20 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/5354