I am running a load test using JMeter and I want take the ConstantThroughputTimer value as user input and set in the JMX XML. The JMeter shell script is being called from a bash script.
Bash Script:
THROUGHPUT_VALUE=121
THROUGHPUT_VALUE=$(echo "$THROUGHPUT_VALUE" | awk '{printf "%.1f", $1}')
$JMETER_INSTALL_DIR/jmeter.sh -n -t $JMETER_LOAD_PROFILE_CONFIG/$PROFILE_FILE_NAME -JThroughput=$THROUGHPUT_VALUE
JMeter JMX XML (This is not complete XML. Just a snippet of the full XML where user defined variable and Throughput time is declared)
<UserParameters guiclass="UserParametersGui" testclass="UserParameters" testname="User Parameters" enabled="true">
<collectionProp name="UserParameters.names">
<stringProp name="904465283">CurrentDay</stringProp>
<stringProp name="-2026347353">CurrentDate</stringProp>
<stringProp name="-2025863226">CurrentTime</stringProp>
<stringProp name="690807817">FinalDate_Header1</stringProp>
<stringProp name="-323914198">throughput</stringProp>
</collectionProp>
<collectionProp name="UserParameters.thread_values">
<collectionProp name="-548354585">
<stringProp name="603506847">${__time(E,)}</stringProp>
<stringProp name="-1521574952">${__time(YYYY-MM-dd)}</stringProp>
<stringProp name="1821498968">${__time(HH:mm:ss)}</stringProp>
<stringProp name="52928079">${__time(E\, dd MMM yyyy\, h:mm:ss,)} +0000</stringProp>
<stringProp name="1446819321">${__P(Throughput)}</stringProp>
</collectionProp></collectionProp> </UserParameters>
<ConstantThroughputTimer guiclass="TestBeanGUI" testclass="ConstantThroughputTimer" testname="Constant Throughput Timer" enabled="true">
<intProp name="calcMode">0</intProp>
<doubleProp>
<name>throughput</name>
<value>${__P(Throughput)}</value>
<savedValue>0.0</savedValue>
</doubleProp>
</ConstantThroughputTimer>
But JMeter is throwing error
Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'/mnt/Test.jmx'.
Cause:
NumberFormatException: For input string: "${__P(Throughput)}"
Detail:com.thoughtworks.xstream.converters.ConversionException:
---- Debugging information ----
cause-exception : com.thoughtworks.xstream.converters.ConversionException
cause-message :
first-jmeter-class : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:109)
class : org.apache.jmeter.save.ScriptWrapper
required-type : org.apache.jmeter.save.ScriptWrapper
converter-type : org.apache.jmeter.save.ScriptWrapperConverter
path : /jmeterTestPlan/hashTree/hashTree/hashTree[3]/ConstantThroughputTimer/doubleProp/value
line number : 461
version : 5.5
-------------------------------
Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'/mnt/Test.jmx'.
Cause:
NumberFormatException: For input string: "${__P(Throughput)}"
Detail:com.thoughtworks.xstream.converters.ConversionException:
---- Debugging information ----
cause-exception : com.thoughtworks.xstream.converters.ConversionException
cause-message :
first-jmeter-class : org.apache.jmeter.save.converters.TestElementConverter.unmarshal(TestElementConverter.java:109)
class : org.apache.jmeter.save.ScriptWrapper
required-type : org.apache.jmeter.save.ScriptWrapper
converter-type : org.apache.jmeter.save.ScriptWrapperConverter
path : /jmeterTestPlan/hashTree/hashTree/hashTree[3]/ConstantThroughputTimer/doubleProp/value
line number : 282
version : 5.5
I even changed the property of the XML from
<stringProp name="-323914198">${__P(Throughput)}</stringProp> to <doubleProp name="-323914198">${__P(Throughput)}</doubleProp>
thinking that it's a float or double value. But still getting same error. Is there any way I can resolve this?
