You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2018/05/23 16:15:54 UTC

[Bug 62403] New: timeShift always takes current date even if the 'Date to shift' parameter is specified

https://bz.apache.org/bugzilla/show_bug.cgi?id=62403

            Bug ID: 62403
           Summary: timeShift always takes current date even if the 'Date
                    to shift' parameter is specified
           Product: JMeter
           Version: 4.0
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: valpetrovsky@gmail.com
  Target Milestone: ---

1. Create a test plan with a BeanShell sampler with the following code inside:

String date = "${__timeShift(dd.MM.yyyy,'24.05.2016',-P1D,,)}";
print(date);

2. Run it and look at JMeter's console.
Expected: 23.05.2016
Observed: 22.05.2018

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62403] timeShift always takes current date even if the 'Date to shift' parameter is specified

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62403

Valentine Petrovsky <va...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Valentine Petrovsky <va...@gmail.com> ---
Initially got the error with JMeter 3.3.
The JUnit test TestTimeShiftFunction.testNowPlusOneDayWithLocale had not passed
build.
Wondering about not detecting the problem before the release of JMeter 4.0. It
has been released in Feb 2018. The test could pass only in 2017.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62403] timeShift always takes current date even if the 'Date to shift' parameter is specified

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62403

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
             Status|NEW                         |NEEDINFO

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
(In reply to Valentine Petrovsky from comment #1)
> Initially got the error with JMeter 3.3.
> The JUnit test TestTimeShiftFunction.testNowPlusOneDayWithLocale had not
> passed build.
> Wondering about not detecting the problem before the release of JMeter 4.0.
> It has been released in Feb 2018. The test could pass only in 2017.

It works for me using nightly build and JMeter 4.0.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62403] timeShift always takes current date even if the 'Date to shift' parameter is specified

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62403

Valentine Petrovsky <va...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Valentine Petrovsky <va...@gmail.com> ---
Found why a test was not passed in JMeter 3.3. 

In org.apache.jmeter.functions.TestTimeShiftFunction class:

JMeter 3.3:
Collection<CompoundVariable> params = makeParams("YYYY-MMMM-dd",
"2017-juillet-01", "P1D", "fr_FR", "");
Current:
Collection<CompoundVariable> params = makeParams("yyyy-MMMM-dd",
"2017-juillet-01", "P1D", "fr_FR", "");

Note the difference for year format: YYYY vs yyyy. The first stands for so
called week year. I did't dig into details, but it works correctly when current
year is equal to the year in function argument. This is why the test had been
passing in 2017.

Thus, it was a JUnit test problem - not of the function code. And my example in
description is mistaken since it contains single quotes in the second argument.

-- 
You are receiving this mail because:
You are the assignee for the bug.