2

I wrote jmeter test for testing the performance of site. So I would like to testing the work of site when there are a lot of user, for example ten. I created JMeter Test plan, with a 10 concurrent users there. For each user request should contain unique headers:

<HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="headers" enabled="true">
      <collectionProp name="HeaderManager.headers">
        <elementProp name="" elementType="Header">
          <stringProp name="Header.name">myHeader</stringProp>
          <stringProp name="Header.value">60000${__counter(FALSE)}${__machineName}</stringProp>
        </elementProp>

This testplan is working fine when I run it using JMeter GUI tool - the result is:

<httpSample t="14774" it="0" lt="14772" ts="1320656944945" s="true" lb="HTTP Request" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" de="UTF-8" by="15213" sc="1" ec="0" ng="5" na="5">

myHeader: 600001D000753 Connection: keep-alive

But I want to embed these tests to hudson server, so it's need to be able running using maven. And when I run it like 'mvn jmeter:jmeter' - the built-in functions (I used counter and machineName, also tried to use 'threadNum' with the same result) are not working:

<httpSample t="23584" it="0" lt="23557" ts="1320656803378" s="true" lb="HTTP Request" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" de="UTF-8" by="14816" sc="1" ec="0" ng="9" na="9">

myHeader: 60000${_counter(FALSE)}${_machineName} Connection: keep-alive

Why is it so and how can I fix it?

UPD:
I've fixed it in that way: I placed <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="myCounter" enabled="true"> <stringProp name="CounterConfig.start">1</stringProp> <stringProp name="CounterConfig.end">100</stringProp> <stringProp name="CounterConfig.incr">1</stringProp> <stringProp name="CounterConfig.name">myCounter1</stringProp> <stringProp name="CounterConfig.format"></stringProp> <boolProp name="CounterConfig.per_user">false</boolProp> </CounterConfig> in the test plan, and then used ${myCounter1} in the headers config

javagirl
  • 1,635
  • 6
  • 27
  • 43
  • 2
    You can and should post your solution as an answer to this question(which you can accept later). – oers Dec 19 '11 at 12:15
  • oers is right. As a friendly reminder, can you please post an answer to the question yourself and then accept that answer so that we can close this question? Also, you need to accept answers to previous questions if they fix your problem. – Zecas May 28 '12 at 12:01

1 Answers1

0

UPD: I've fixed it in that way: I placed <CounterConfig guiclass="CounterConfigGui" testclass="CounterConfig" testname="myCounter" enabled="true"> <stringProp name="CounterConfig.start">1</stringProp> <stringProp name="CounterConfig.end">100</stringProp> <stringProp name="CounterConfig.incr">1</stringProp> <stringProp name="CounterConfig.name">myCounter1</stringProp> <stringProp name="CounterConfig.format"></stringProp> <boolProp name="CounterConfig.per_user">false</boolProp> </CounterConfig> in the test plan, and then used ${myCounter1} in the headers config

javagirl
  • 1,635
  • 6
  • 27
  • 43