jmeter-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 62675] New: ConstantThroughputTimer bad setting properties, and not included in TestPlan
Date Tue, 04 Sep 2018 19:43:01 GMT

            Bug ID: 62675
           Summary: ConstantThroughputTimer bad setting properties, and
                    not included in TestPlan
           Product: JMeter
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Main
  Target Milestone: ---

Created attachment 36131
SetCalcMode Should be 3, but is 0. Same with SetThroughput, should be 20

When implementing ConstantThroughputTimer from java code, it's properties
"throughput" and "mode" are not correctly setted up.

While I do:

  ConstantThroughputTimer constThroughputTimer = new ConstantThroughputTimer();


// with samplesPerMinute = 20

But when I save TreePlan, those 2 props are not present:

      <ConstantThroughputTimer testclass="ConstantThroughputTimer"
testname="Constant Throughput Timer" enabled="true"/>

And when executed with:

  StandardJMeterEngine jMeterEngineStd = jmeterPlan.getJMeterEngineStd();

It never finishes. Debuging from 
there's a moment when 
  invokeOrBailOut is call (in
when called for method setCalcMode, value should be 3, but it is 0

And similiar thing happen with method
when value should be 20, but ti is 0.0

Inspecting code, I found differences in how ConstantThroughputTimer set
property values, compare to other timers like ConstantTimer.

In ConstantThroughputTimer

lines 118
  public void setThroughput(double throughput) {
        this.throughput = throughput;

and 135
  public void setCalcMode(int mode) {
        this.mode = Mode.values()[mode];

While in ConstantTimer

line 51
  public void setDelay(String delay) {
        setProperty(DELAY, delay);

So I tryextending ConstantThroughputTimer:

  public class ConstantThroughputTimerBugSolution extends
ConstantThroughputTimer {

        private static final long serialVersionUID = 4;

        /** Key for storing assertion-information in the jmx-file. */
        public static final String THROUGHPUT_KEY = "throughput"; //
        public static final String CALC_MODE_KEY = "calcMode"; // $NON-NLS-1$

        public void setThroughput(double throughput) {
                super.setThroughput(throughput); // just in case
                setProperty(new DoubleProperty(THROUGHPUT_KEY, throughput));

        public void setCalcMode(int mode) {
                super.setCalcMode(mode); // just in case
                setProperty(CALC_MODE_KEY, mode);

And it works just fine. Mode and Throughput have proper values, and even more,
it is correctly setted up in TestPlan:

   <ConstantThroughputTimerBugSolution testclass="ConstantThroughputTimer"
testname="Constant Throughput Timer" enabled="true">
      <intProp name="calcMode">3</intProp>

Exactly same problem I found with CompareAssertion, and same kind of resolve.
And I saw many clases with same of property settings

Hope this help

You are receiving this mail because:
You are the assignee for the bug.
View raw message