Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Constant Timer strange behavior when used with variables or functions #6162

@KingRabbid

Description

@KingRabbid

Expected behavior

When the value of a Constant Timer references a variable or a function call the following must be preserved (as it happens for a numeric value):

  1. Constant Timer runs after a PreProcessor
  2. Constant Timer does NOT run as the 1st element in a JMX

I see a problem with current behavior:

  1. Either the documentation should be clear about restriction to use anything else than numeric values and also implement a validation which rejects any other format value
  2. Or fix the current issue(s)

Note: I think Constant Timer is used by other timers (Random ones) so they may be impacted as well.

Actual behavior

I've spotted strange behavior from Constant Timer when the value references a variable or a function call:

  1. It runs as 1st element in a JMX
  2. It is executed before a JSR223PreProcessor (probably before any PreProcessor)

This is not valid if the value is entirely a numeric constant; this is also not valid for a JSR223Timer.

What I can see:

  1. Because Constant Timer's are executed as 1st elements from the tree when they are attached to the ThreadGroup then they throw NullPointerException because the variable is unknown (see JMX for tree structure)
  2. On Constant Timer branch in case of Flow Control Action 2 the timer is executed before the JSR223PreProcessor (visible in log and sampler timestamps) => this is not as per documentation
  3. Initially I've spotted the issue having Flow Control Action samplers and I thought it's an issue with them or in this combination; next I've used JSR223Sampler elements but outcome is the same.

jmeter.log
ConstantTimer-bug.zip

Steps to reproduce the problem

Attaching sample JMX; I do recommend to set log level to DEBUG to see sequence of execution better.

JMeter Version

5.6.2, 4.0

Java Version

OpenJDK 64-Bit v17.0.9

OS Version

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions