RandomDate ignores inclusive end date and throws when start == end
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java
- Domain
- testing-qa
Research direction
Start by locating the __RandomDate function implementation and reproduce the two calls described in the issue, including the single-date case. Update the behavior so the configured end date can be returned and equal start and end dates succeed, then add or run tests covering both cases.
Written by the indexing model from the issue text.
Description
Expected behavior
The __RandomDate function should treat the provided end date as inclusive. When the start and end dates are the same, the function should simply return that single date (and store it in the target variable) instead of failing.
Actual behavior
-
When
startDate < endDate, the function never returns the configured end date. It behaves as if the interval were [start, end) (exclusive upper bound). -
When
startDate == endDate, the call toThreadLocalRandom.nextLong(start, end)raisesIllegalArgumentException: bound must be greater than origin, so the function errors out instead of returning the only valid date.
Steps to reproduce the problem
- Create a test plan with a Debug Sampler and a Simple Data Writer (or just watch the Debug Sampler output).
- Add a User Parameters or a JSR223 Sampler to evaluate
${__RandomDate(yyyy-MM-dd,2111-03-29,2111-03-30,,MY_VAR)}. - Run the plan multiple times. Observe that the logged value is always
2111-03-29andMY_VARnever contains2111-03-30. - Change the call to
${__RandomDate(yyyy-MM-dd,2111-03-29,2111-03-29,,MY_VAR)}and run again. The sampler now fails with theIllegalArgumentExceptionmentioned above.
JMeter Version
6.0.0-SNAPSHOT
Java Version
OpenJDK Runtime Environment 21.0.8 (2025-07-16)
OS Version
Linux 6.6.87.2-microsoft-standard-WSL2 (running under Windows 11 / WSL2)
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/jmeter
-
defect to-triage
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
enhancement to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
documentation to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
invalid wontfix
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
P2
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100