jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [jmeter] tilln opened a new pull request #606: Fix for control flow behavior regression
Date Thu, 23 Jul 2020 05:24:43 GMT

tilln opened a new pull request #606:
URL: https://github.com/apache/jmeter/pull/606


   ## Description
   
   Programmatic manipulation of the control flow via API methods of `JMeterContext` is not
working as it used to.
   
   When JMeter v5.0 introduced the "ability to Switch to next iteration of Current Loop" (see
[Bug 62238](https://bz.apache.org/bugzilla/show_bug.cgi?id=62238)) the changes to `JMeterThread`
were not entirely logically equivalent and broke some of our existing test when migrating
to v5.x.
   
   The simplest test plan to demonstrate this is as follows, where the Debug Sampler should
never be run.
   (This works up to JMeter v4.0 and fails in v5.0 and above.)
   
   ```
   Test Plan
       \ Thread Group
           \ JSR223 Sampler
               ctx.setStartNextThreadLoop(true)
           \ Debug Sampler
   ```
   
   Reason is the following change ([refer here](https://github.com/apache/jmeter/commit/29b3fd0add89b589c550e4e1a3063e47e798ae91#diff-dede292dd6c37518e9b6661d04dbf4abL539-R583))
   
   When processing the sample result, the "logical action" would only be changed if the result
carried the "restart flag":
   ```
   if(result.isStartNextThreadLoop()) {	            
       threadContext.setStartNextThreadLoop(true);	
   }
   ```
   
   But now the result unconditionally overwrites the context's "logical action":
   ```
   threadContext.setTestLogicalAction(result.getTestLogicalAction());
   ```
   
   This PR proposes to make the action change conditional again: only if different than `CONTINUE`
   ```
   if (result.getTestLogicalAction() != TestLogicalAction.CONTINUE) {
       threadContext.setTestLogicalAction(result.getTestLogicalAction());
   }
   ```
   
   
   ## Motivation and Context
   
   This fixes a breaking change from JMeter v4.0 to v5.0 that was supposed to be non-breaking.
   Workarounds involve changing existing test plans by for example using 
   `prev.setStartNextThreadLoop(true)` (or the non-deprecated equivalent)
   but this does not work everywhere e.g. in Preprocessors where there is no `SampleResult`
yet.
   
   
   ## How Has This Been Tested?
   
   Has not yet been tested due to the trivial nature of the change.
   
   ## Screenshots (if appropriate):
   
   ## Types of changes
   - Bug fix (non-breaking change which fixes an issue)
   
   ## Checklist:
   - [x] My code follows the [code style][style-guide] of this project.
   - [ ] I have updated the documentation accordingly.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message