You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Prasad Iyer <pr...@ymail.com> on 2009/04/19 06:33:07 UTC

Having problem extending Controller

Hi,
I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
I am developing this on Eclipse IDE
My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.  


Following is the stack trace

cause-exception     : com.thoughtworks.xstream.converters.ConversionException
cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
class               : org.apache.jmeter.save.ScriptWrapper
required-type       : org.apache.jorphan.collections.ListedHashTree
path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
line number         : 46
-------------------------------
2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
        at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
        at org.apache.jmeter.JMeter.run(JMeter.java:728)
        at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
        at org.apache.jmeter.JMeter.start(JMeter.java:361)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.jmeter.NewDriver.main(NewDriver.java:210)


<!-- 
following is my JMX file
-->
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.1">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1240084414000</longProp>
        <longProp name="ThreadGroup.end_time">1240084414000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
        <hashTree>
          <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
            <intProp name="ActionProcessor.action">1</intProp>
            <intProp name="ActionProcessor.target">0</intProp>
            <stringProp name="ActionProcessor.duration"></stringProp>
          </TestAction>
          <hashTree>
            <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
              <stringProp name="filename"></stringProp>
              <stringProp name="parameters"></stringProp>
              <boolProp name="resetInterpreter">false</boolProp>
              <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
System.out.println(&quot;hello world&quot;);</stringProp>
            </BeanShellPreProcessor>
            <hashTree/>
          </hashTree>
          <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
            <stringProp name="EmptyController.condition">str</stringProp>
          </EmptyController>
          <hashTree>
            <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
              <intProp name="ActionProcessor.action">1</intProp>
              <intProp name="ActionProcessor.target">0</intProp>
              <stringProp name="ActionProcessor.duration"></stringProp>
            </TestAction>
            <hashTree>
              <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
                <boolProp name="resetInterpreter">true</boolProp>
                <stringProp name="parameters"></stringProp>
                <stringProp name="filename"></stringProp>
                <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
              </BeanShellPreProcessor>
              <hashTree/>
            </hashTree>
          </hashTree>
        </hashTree>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>


      

Re: Using vars in IfController

Posted by sebb <se...@gmail.com>.
On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Hi,
>  I am trying to use IfController. Sorry I am naive to this application. How do I access a variable stored in vars.
>
>  I want something like this
>
>  ${__BeanShell(vars.get("STR").equals(""))}

JMeter 2.3.2 only supports Javascript in the If condition field.

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#If_Controller

You can use something like:

"${VAR}" == ""

as indicated in the manual page.

>  Thanks for the help

>  regards
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Using vars in IfController

Posted by Prasad Iyer <pr...@ymail.com>.
Hi,
I am trying to use IfController. Sorry I am naive to this application. How do I access a variable stored in vars.

I want something like this

${__BeanShell(vars.get("STR").equals(""))}

Thanks for the help

regards



      

Re: Having problem extending Controller

Posted by sebb <se...@gmail.com>.
Or you could just use the If Controller with the condition:

'${STR}' == '$'+'{STR}'


On 21/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> For the newbies who want to make the Controller.
>  Here it is. This is a sample EmptyController which checks whether the a "STR" variable exist in the JMeterContext
>  ----- Java Code -----
>  package org.apache.jmeter.control;
>
>  import java.io.Serializable;
>
>  import org.apache.jmeter.control.GenericController;
>  import org.apache.jmeter.control.NextIsNullException;
>  import org.apache.jmeter.samplers.Sampler;
>  import org.apache.jmeter.testelement.property.StringProperty;
>  import org.apache.jorphan.logging.LoggingManager;
>  import org.apache.log.Logger;
>
>  public class EmptyController extends GenericController implements Serializable {
>     private static final long serialVersionUID = 1L;
>
>     private static final Logger logger = LoggingManager.getLoggerForClass();
>
>     private final static String CONDITION = "EmptyController.condition"; //$NON-NLS-1$
>
>     @SuppressWarnings("unused")
>     private final static String EVALUATE_ALL = "EmptyController.evaluateAll"; //$NON-NLS-1$
>     private String value;
>
>     public EmptyController() {
>         Thread.dumpStack();
>
>     }
>
>     public EmptyController(String value) {
>         super();
>         this.value = value;
>     }
>
>
>     public void setValue(String value) {
>         setProperty(new StringProperty(CONDITION, value));
>     }
>
>     public String getValue() {
>         return getPropertyAsString(CONDITION);
>     }
>
>     @Override
>     public Sampler next() {
>         boolean result = testEmpty(this.getValue());
>         if (result) {
>             return super.next();
>         }
>         try {
>             return nextIsNull();
>         } catch (NextIsNullException e1) {
>             return null;
>         }
>
>     }
>
>     private boolean testEmpty(String tmp_value) {
>         String str = this.getThreadContext().getVariables().get(tmp_value);
>         if(str == null){
>             return false;
>         }
>         return true;
>     }
>
>     public boolean isEvaluateAll() {
>         return getPropertyAsBoolean(EVALUATE_ALL,false);
>     }
>
>     public void setEvaluateAll(boolean b) {
>         setProperty(EVALUATE_ALL,b);
>     }
>  }
>
>  ----- Property file Code -----
>  ### Add following code to saveservice.properties if you want to add gui you can do that too. Look in the property file for implementation
>  EmptyController=org.apache.jmeter.control.EmptyController
>
>
>  ----- JMX Code -----
>
>
>  <?xml version="1.0" encoding="UTF-8"?>
>  <jmeterTestPlan version="1.2" properties="2.1">
>   <hashTree>
>     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>       <stringProp name="TestPlan.comments"></stringProp>
>       <boolProp name="TestPlan.functional_mode">false</boolProp>
>       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>         <collectionProp name="Arguments.arguments"/>
>       </elementProp>
>       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>     </TestPlan>
>     <hashTree>
>       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>           <boolProp name="LoopController.continue_forever">false</boolProp>
>           <stringProp name="LoopController.loops">1</stringProp>
>         </elementProp>
>         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>
>         <longProp name="ThreadGroup.start_time">1240281184000</longProp>
>         <longProp name="ThreadGroup.end_time">1240281184000</longProp>
>
>         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>         <stringProp name="ThreadGroup.duration"></stringProp>
>         <stringProp name="ThreadGroup.delay"></stringProp>
>       </ThreadGroup>
>       <hashTree>
>
>         <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>           <intProp name="ActionProcessor.action">1</intProp>
>           <intProp name="ActionProcessor.target">0</intProp>
>           <stringProp name="ActionProcessor.duration"></stringProp>
>         </TestAction>
>         <hashTree>
>           <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>             <stringProp name="filename"></stringProp>
>             <stringProp name="parameters"></stringProp>
>             <boolProp name="resetInterpreter">false</boolProp>
>
>             <stringProp name="script">vars.put(&quot;COOLER&quot;,&quot;hello world&quot;);</stringProp>
>
>           </BeanShellPreProcessor>
>           <hashTree/>
>         </hashTree>
>         <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>
>           <stringProp name="EmptyController.condition">STR</stringProp>
>           <stringProp name="EmptyController.evaluateAll">false</stringProp>
>
>         </EmptyController>
>         <hashTree>
>           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>             <intProp name="ActionProcessor.action">1</intProp>
>             <intProp name="ActionProcessor.target">0</intProp>
>             <stringProp name="ActionProcessor.duration"></stringProp>
>           </TestAction>
>           <hashTree>
>             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>               <boolProp name="resetInterpreter">true</boolProp>
>               <stringProp name="parameters"></stringProp>
>               <stringProp name="filename"></stringProp>
>
>               <stringProp name="script">System.out.println(vars.get(&quot;STR&quot;));</stringProp>
>
>             </BeanShellPreProcessor>
>             <hashTree/>
>           </hashTree>
>         </hashTree>
>       </hashTree>
>     </hashTree>
>   </hashTree>
>
> </jmeterTestPlan>
>
>
>  I guess some people think that this mailing list is substitute for Hard Work. Anyway thanks for feeding my ego.
>  Later.........................................................................................................
>
>  -----x snip
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Having problem extending Controller

Posted by Prasad Iyer <pr...@ymail.com>.
For the newbies who want to make the Controller.
Here it is. This is a sample EmptyController which checks whether the a "STR" variable exist in the JMeterContext
----- Java Code -----
package org.apache.jmeter.control;

import java.io.Serializable;

import org.apache.jmeter.control.GenericController;
import org.apache.jmeter.control.NextIsNullException;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.testelement.property.StringProperty;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

public class EmptyController extends GenericController implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private static final Logger logger = LoggingManager.getLoggerForClass();

    private final static String CONDITION = "EmptyController.condition"; //$NON-NLS-1$

    @SuppressWarnings("unused")
    private final static String EVALUATE_ALL = "EmptyController.evaluateAll"; //$NON-NLS-1$
    private String value;

    public EmptyController() {
        Thread.dumpStack();

    }

    public EmptyController(String value) {
        super();
        this.value = value;
    }


    public void setValue(String value) {
        setProperty(new StringProperty(CONDITION, value));
    }
    
    public String getValue() {
        return getPropertyAsString(CONDITION);
    }

    @Override
    public Sampler next() {
        boolean result = testEmpty(this.getValue());
        if (result) {
            return super.next();
        }
        try {
            return nextIsNull();
        } catch (NextIsNullException e1) {
            return null;
        }

    }

    private boolean testEmpty(String tmp_value) {
        String str = this.getThreadContext().getVariables().get(tmp_value);
        if(str == null){
            return false;
        }
        return true;
    }
    
    public boolean isEvaluateAll() {
        return getPropertyAsBoolean(EVALUATE_ALL,false);
    }

    public void setEvaluateAll(boolean b) {
        setProperty(EVALUATE_ALL,b);
    }
}

----- Property file Code -----
### Add following code to saveservice.properties if you want to add gui you can do that too. Look in the property file for implementation
EmptyController=org.apache.jmeter.control.EmptyController


----- JMX Code -----

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.1">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <longProp name="ThreadGroup.start_time">1240281184000</longProp>
        <longProp name="ThreadGroup.end_time">1240281184000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
          <intProp name="ActionProcessor.action">1</intProp>
          <intProp name="ActionProcessor.target">0</intProp>
          <stringProp name="ActionProcessor.duration"></stringProp>
        </TestAction>
        <hashTree>
          <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
            <stringProp name="filename"></stringProp>
            <stringProp name="parameters"></stringProp>
            <boolProp name="resetInterpreter">false</boolProp>
            <stringProp name="script">vars.put(&quot;COOLER&quot;,&quot;hello world&quot;);</stringProp>
          </BeanShellPreProcessor>
          <hashTree/>
        </hashTree>
        <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
          <stringProp name="EmptyController.condition">STR</stringProp>
          <stringProp name="EmptyController.evaluateAll">false</stringProp>
        </EmptyController>
        <hashTree>
          <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
            <intProp name="ActionProcessor.action">1</intProp>
            <intProp name="ActionProcessor.target">0</intProp>
            <stringProp name="ActionProcessor.duration"></stringProp>
          </TestAction>
          <hashTree>
            <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
              <boolProp name="resetInterpreter">true</boolProp>
              <stringProp name="parameters"></stringProp>
              <stringProp name="filename"></stringProp>
              <stringProp name="script">System.out.println(vars.get(&quot;STR&quot;));</stringProp>
            </BeanShellPreProcessor>
            <hashTree/>
          </hashTree>
        </hashTree>
      </hashTree>
    </hashTree>
  </hashTree>
</jmeterTestPlan>


I guess some people think that this mailing list is substitute for Hard Work. Anyway thanks for feeding my ego.
Later.........................................................................................................

-----x snip



      

Re: Having problem extending Controller

Posted by sebb <se...@gmail.com>.
On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Hi Sebb,
>  Thanks for being so patient with me.
>  Since you are persuading me so much. Let us step back.
>  I guess this would be my last question.
>  Does creating a controller requires to build JMeter from the scratch? In other words would I be touching the core JMeter just to create a controller?

I think the best answer to that is, if you need to ask this question,
then you probably should not be attempting to do it.

>  Once again thanks, Help appreciated
>
>
>  regards
>
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>
> Sent: Monday, April 20, 2009 10:00:42 AM
>
> Subject: Re: Having problem extending Controller
>
>  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > Following is the test case I want to write.
>  >  Its a workflow testing that I am doing. Depending upon the response of the first web service. I want to select the other web services. There around 7 x 20 path that can be selected depending upon the response.
>  >
>  >  I did try IfController but there are just too many If's. So I thought about giving it a try.
>  >
>
>  In that case, it sounds like the Switch Controller is what you want.
>
>  >  regards
>  >
>  >
>  >
>  >
>  >  ________________________________
>  >  From: sebb <se...@gmail.com>
>  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >
>  > Sent: Monday, April 20, 2009 9:19:01 AM
>  >
>  > Subject: Re: Having problem extending Controller
>  >
>  >  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  > I have already done that. But I don't just need one IfController.
>  >  >  I still have one week, I would try to find out how the IfController works
>  >
>  >  That's my point - you don't really need to know how the If Controller
>  >  works; just change the code that decides whether or not to run its
>  >  children to include whatever additional checks need to be made.
>  >
>  >  However, it's still not clear to me why the If Controller is
>  >  unsuitable, given that it can process an arbitrary condition using
>  >  either Javascript or any other function or variable.
>  >
>  >  >  Many thanks for the help
>  >  >
>  >  > regards
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  ________________________________
>  >  >  From: sebb <se...@gmail.com>
>  >  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >  >
>  >  > Sent: Monday, April 20, 2009 4:01:26 AM
>  >  >
>  >  > Subject: Re: Having problem extending Controller
>  >  >
>  >  >  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  >  > Thanks for the reply
>  >  >  >  I tried IfController. But I have too many complicated conditions to check before executing the sample.
>  >  >
>  >  >  Such as?
>  >  >
>  >  >  If you really want to write your own code, then the best way to go
>  >  >  would probably be to take a copy of If Controller and amend the part
>  >  >  that checks the condition, rather than starting afresh. That should be
>  >  >  a lot easier.
>  >  >
>  >  >  >  I am doing web service testing.
>  >  >  >  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  >  >  >  Can you please help me?
>  >  >  >  regards
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  ________________________________
>  >  >  >  From: sebb <se...@gmail.com>
>  >  >  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >  >  >  Sent: Sunday, April 19, 2009 4:16:46 PM
>  >  >  >  Subject: Re: Having problem extending Controller
>  >  >  >
>  >  >  >
>  >  >  >  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  >  >  > Hi,
>  >  >  >  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  >  >  >  I am developing this on Eclipse IDE
>  >  >  >  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>  >  >  >
>  >  >  >  Why is the If Controller no good?
>  >  >  >
>  >  >  >  Note that the way the controllers interact is the most complicated
>  >  >  >  part of JMeter, so I would avoid going down that route unless you are
>  >  >  >  prepared for a lot of hard work.
>  >  >  >
>  >  >  >  >
>  >  >  >  >  Following is the stack trace
>  >  >  >  >
>  >  >  >  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  >  >  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  >  >  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  >  >  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  >  >  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  >  >  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  >  >  >  line number         : 46
>  >  >  >  >  -------------------------------
>  >  >  >  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >  >  >  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >  >  >  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >  >  >  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >  >  >  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >  >  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >  >  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >  >  >  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >  >  >  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >  >  >  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  <!--
>  >  >  >  >  following is my JMX file
>  >  >  >  >  -->
>  >  >  >  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  >  >  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >  >  >  >   <hashTree>
>  >  >  >  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >  >  >  >       <stringProp name="TestPlan.comments"></stringProp>
>  >  >  >  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >  >  >  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >  >  >  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >  >  >  >         <collectionProp name="Arguments.arguments"/>
>  >  >  >  >       </elementProp>
>  >  >  >  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >  >  >  >     </TestPlan>
>  >  >  >  >     <hashTree>
>  >  >  >  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >  >  >  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >  >  >  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >  >  >  >           <stringProp name="LoopController.loops">1</stringProp>
>  >  >  >  >         </elementProp>
>  >  >  >  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >  >  >  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >  >  >  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >  >  >  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >  >  >  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >  >  >  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >  >  >  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >  >  >  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >  >  >  >       </ThreadGroup>
>  >  >  >  >       <hashTree>
>  >  >  >  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >  >  >  >         <hashTree>
>  >  >  >  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >  >  >             <intProp name="ActionProcessor.action">1</intProp>
>  >  >  >  >             <intProp name="ActionProcessor.target">0</intProp>
>  >  >  >  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >  >  >           </TestAction>
>  >  >  >  >           <hashTree>
>  >  >  >  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >  >  >               <stringProp name="filename"></stringProp>
>  >  >  >  >               <stringProp name="parameters"></stringProp>
>  >  >  >  >               <boolProp name="resetInterpreter">false</boolProp>
>  >  >  >  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  >  >  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >  >  >             </BeanShellPreProcessor>
>  >  >  >  >             <hashTree/>
>  >  >  >  >           </hashTree>
>  >  >  >  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >  >  >  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >  >  >  >           </EmptyController>
>  >  >  >  >           <hashTree>
>  >  >  >  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >  >  >               <intProp name="ActionProcessor.action">1</intProp>
>  >  >  >  >               <intProp name="ActionProcessor.target">0</intProp>
>  >  >  >  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >  >  >             </TestAction>
>  >  >  >  >             <hashTree>
>  >  >  >  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >  >  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >  >  >  >                 <stringProp name="parameters"></stringProp>
>  >  >  >  >                 <stringProp name="filename"></stringProp>
>  >  >  >  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >  >  >               </BeanShellPreProcessor>
>  >  >  >  >               <hashTree/>
>  >  >  >  >             </hashTree>
>  >  >  >  >           </hashTree>
>  >  >  >  >         </hashTree>
>  >  >  >  >       </hashTree>
>  >  >  >  >     </hashTree>
>  >  >  >  >   </hashTree>
>  >  >  >  >  </jmeterTestPlan>
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  >  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >
>  >  >  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >  >
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Having problem extending Controller

Posted by Prasad Iyer <pr...@ymail.com>.
Hi Sebb,
Thanks for being so patient with me.
Since you are persuading me so much. Let us step back.
I guess this would be my last question. 
Does creating a controller requires to build JMeter from the scratch? In other words would I be touching the core JMeter just to create a controller?

Once again thanks, Help appreciated

regards





________________________________
From: sebb <se...@gmail.com>
To: JMeter Users List <jm...@jakarta.apache.org>
Sent: Monday, April 20, 2009 10:00:42 AM
Subject: Re: Having problem extending Controller

On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Following is the test case I want to write.
>  Its a workflow testing that I am doing. Depending upon the response of the first web service. I want to select the other web services. There around 7 x 20 path that can be selected depending upon the response.
>
>  I did try IfController but there are just too many If's. So I thought about giving it a try.
>

In that case, it sounds like the Switch Controller is what you want.

>  regards
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>
> Sent: Monday, April 20, 2009 9:19:01 AM
>
> Subject: Re: Having problem extending Controller
>
>  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > I have already done that. But I don't just need one IfController.
>  >  I still have one week, I would try to find out how the IfController works
>
>  That's my point - you don't really need to know how the If Controller
>  works; just change the code that decides whether or not to run its
>  children to include whatever additional checks need to be made.
>
>  However, it's still not clear to me why the If Controller is
>  unsuitable, given that it can process an arbitrary condition using
>  either Javascript or any other function or variable.
>
>  >  Many thanks for the help
>  >
>  > regards
>  >
>  >
>  >
>  >
>  >
>  >  ________________________________
>  >  From: sebb <se...@gmail.com>
>  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >
>  > Sent: Monday, April 20, 2009 4:01:26 AM
>  >
>  > Subject: Re: Having problem extending Controller
>  >
>  >  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  > Thanks for the reply
>  >  >  I tried IfController. But I have too many complicated conditions to check before executing the sample.
>  >
>  >  Such as?
>  >
>  >  If you really want to write your own code, then the best way to go
>  >  would probably be to take a copy of If Controller and amend the part
>  >  that checks the condition, rather than starting afresh. That should be
>  >  a lot easier.
>  >
>  >  >  I am doing web service testing.
>  >  >  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  >  >  Can you please help me?
>  >  >  regards
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  ________________________________
>  >  >  From: sebb <se...@gmail.com>
>  >  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >  >  Sent: Sunday, April 19, 2009 4:16:46 PM
>  >  >  Subject: Re: Having problem extending Controller
>  >  >
>  >  >
>  >  >  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  >  > Hi,
>  >  >  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  >  >  I am developing this on Eclipse IDE
>  >  >  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>  >  >
>  >  >  Why is the If Controller no good?
>  >  >
>  >  >  Note that the way the controllers interact is the most complicated
>  >  >  part of JMeter, so I would avoid going down that route unless you are
>  >  >  prepared for a lot of hard work.
>  >  >
>  >  >  >
>  >  >  >  Following is the stack trace
>  >  >  >
>  >  >  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  >  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  >  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  >  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  >  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  >  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  >  >  line number         : 46
>  >  >  >  -------------------------------
>  >  >  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >  >  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >  >  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >  >  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >  >  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >  >  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >  >  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >  >  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >  >  >
>  >  >  >
>  >  >  >  <!--
>  >  >  >  following is my JMX file
>  >  >  >  -->
>  >  >  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  >  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >  >  >   <hashTree>
>  >  >  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >  >  >       <stringProp name="TestPlan.comments"></stringProp>
>  >  >  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >  >  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >  >  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >  >  >         <collectionProp name="Arguments.arguments"/>
>  >  >  >       </elementProp>
>  >  >  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >  >  >     </TestPlan>
>  >  >  >     <hashTree>
>  >  >  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >  >  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >  >  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >  >  >           <stringProp name="LoopController.loops">1</stringProp>
>  >  >  >         </elementProp>
>  >  >  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >  >  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >  >  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >  >  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >  >  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >  >  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >  >  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >  >  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >  >  >       </ThreadGroup>
>  >  >  >       <hashTree>
>  >  >  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >  >  >         <hashTree>
>  >  >  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >  >             <intProp name="ActionProcessor.action">1</intProp>
>  >  >  >             <intProp name="ActionProcessor.target">0</intProp>
>  >  >  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >  >           </TestAction>
>  >  >  >           <hashTree>
>  >  >  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >  >               <stringProp name="filename"></stringProp>
>  >  >  >               <stringProp name="parameters"></stringProp>
>  >  >  >               <boolProp name="resetInterpreter">false</boolProp>
>  >  >  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  >  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >  >             </BeanShellPreProcessor>
>  >  >  >             <hashTree/>
>  >  >  >           </hashTree>
>  >  >  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >  >  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >  >  >           </EmptyController>
>  >  >  >           <hashTree>
>  >  >  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >  >               <intProp name="ActionProcessor.action">1</intProp>
>  >  >  >               <intProp name="ActionProcessor.target">0</intProp>
>  >  >  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >  >             </TestAction>
>  >  >  >             <hashTree>
>  >  >  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >  >  >                 <stringProp name="parameters"></stringProp>
>  >  >  >                 <stringProp name="filename"></stringProp>
>  >  >  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >  >               </BeanShellPreProcessor>
>  >  >  >               <hashTree/>
>  >  >  >             </hashTree>
>  >  >  >           </hashTree>
>  >  >  >         </hashTree>
>  >  >  >       </hashTree>
>  >  >  >     </hashTree>
>  >  >  >   </hashTree>
>  >  >  >  </jmeterTestPlan>
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  >  > ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >  >
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


      

Re: Having problem extending Controller

Posted by sebb <se...@gmail.com>.
On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Following is the test case I want to write.
>  Its a workflow testing that I am doing. Depending upon the response of the first web service. I want to select the other web services. There around 7 x 20 path that can be selected depending upon the response.
>
>  I did try IfController but there are just too many If's. So I thought about giving it a try.
>

In that case, it sounds like the Switch Controller is what you want.

>  regards
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>
> Sent: Monday, April 20, 2009 9:19:01 AM
>
> Subject: Re: Having problem extending Controller
>
>  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > I have already done that. But I don't just need one IfController.
>  >  I still have one week, I would try to find out how the IfController works
>
>  That's my point - you don't really need to know how the If Controller
>  works; just change the code that decides whether or not to run its
>  children to include whatever additional checks need to be made.
>
>  However, it's still not clear to me why the If Controller is
>  unsuitable, given that it can process an arbitrary condition using
>  either Javascript or any other function or variable.
>
>  >  Many thanks for the help
>  >
>  > regards
>  >
>  >
>  >
>  >
>  >
>  >  ________________________________
>  >  From: sebb <se...@gmail.com>
>  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >
>  > Sent: Monday, April 20, 2009 4:01:26 AM
>  >
>  > Subject: Re: Having problem extending Controller
>  >
>  >  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  > Thanks for the reply
>  >  >  I tried IfController. But I have too many complicated conditions to check before executing the sample.
>  >
>  >  Such as?
>  >
>  >  If you really want to write your own code, then the best way to go
>  >  would probably be to take a copy of If Controller and amend the part
>  >  that checks the condition, rather than starting afresh. That should be
>  >  a lot easier.
>  >
>  >  >  I am doing web service testing.
>  >  >  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  >  >  Can you please help me?
>  >  >  regards
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  ________________________________
>  >  >  From: sebb <se...@gmail.com>
>  >  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >  >  Sent: Sunday, April 19, 2009 4:16:46 PM
>  >  >  Subject: Re: Having problem extending Controller
>  >  >
>  >  >
>  >  >  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  >  > Hi,
>  >  >  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  >  >  I am developing this on Eclipse IDE
>  >  >  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>  >  >
>  >  >  Why is the If Controller no good?
>  >  >
>  >  >  Note that the way the controllers interact is the most complicated
>  >  >  part of JMeter, so I would avoid going down that route unless you are
>  >  >  prepared for a lot of hard work.
>  >  >
>  >  >  >
>  >  >  >  Following is the stack trace
>  >  >  >
>  >  >  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  >  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  >  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  >  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  >  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  >  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  >  >  line number         : 46
>  >  >  >  -------------------------------
>  >  >  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >  >  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >  >  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >  >  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >  >  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >  >  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >  >  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >  >  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >  >  >
>  >  >  >
>  >  >  >  <!--
>  >  >  >  following is my JMX file
>  >  >  >  -->
>  >  >  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  >  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >  >  >   <hashTree>
>  >  >  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >  >  >       <stringProp name="TestPlan.comments"></stringProp>
>  >  >  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >  >  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >  >  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >  >  >         <collectionProp name="Arguments.arguments"/>
>  >  >  >       </elementProp>
>  >  >  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >  >  >     </TestPlan>
>  >  >  >     <hashTree>
>  >  >  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >  >  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >  >  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >  >  >           <stringProp name="LoopController.loops">1</stringProp>
>  >  >  >         </elementProp>
>  >  >  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >  >  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >  >  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >  >  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >  >  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >  >  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >  >  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >  >  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >  >  >       </ThreadGroup>
>  >  >  >       <hashTree>
>  >  >  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >  >  >         <hashTree>
>  >  >  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >  >             <intProp name="ActionProcessor.action">1</intProp>
>  >  >  >             <intProp name="ActionProcessor.target">0</intProp>
>  >  >  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >  >           </TestAction>
>  >  >  >           <hashTree>
>  >  >  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >  >               <stringProp name="filename"></stringProp>
>  >  >  >               <stringProp name="parameters"></stringProp>
>  >  >  >               <boolProp name="resetInterpreter">false</boolProp>
>  >  >  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  >  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >  >             </BeanShellPreProcessor>
>  >  >  >             <hashTree/>
>  >  >  >           </hashTree>
>  >  >  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >  >  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >  >  >           </EmptyController>
>  >  >  >           <hashTree>
>  >  >  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >  >               <intProp name="ActionProcessor.action">1</intProp>
>  >  >  >               <intProp name="ActionProcessor.target">0</intProp>
>  >  >  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >  >             </TestAction>
>  >  >  >             <hashTree>
>  >  >  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >  >  >                 <stringProp name="parameters"></stringProp>
>  >  >  >                 <stringProp name="filename"></stringProp>
>  >  >  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >  >               </BeanShellPreProcessor>
>  >  >  >               <hashTree/>
>  >  >  >             </hashTree>
>  >  >  >           </hashTree>
>  >  >  >         </hashTree>
>  >  >  >       </hashTree>
>  >  >  >     </hashTree>
>  >  >  >   </hashTree>
>  >  >  >  </jmeterTestPlan>
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  >  > ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >  >
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Having problem extending Controller

Posted by Prasad Iyer <pr...@ymail.com>.
Following is the test case I want to write.
Its a workflow testing that I am doing. Depending upon the response of the first web service. I want to select the other web services. There around 7 x 20 path that can be selected depending upon the response.

I did try IfController but there are just too many If's. So I thought about giving it a try. 

regards




________________________________
From: sebb <se...@gmail.com>
To: JMeter Users List <jm...@jakarta.apache.org>
Sent: Monday, April 20, 2009 9:19:01 AM
Subject: Re: Having problem extending Controller

On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> I have already done that. But I don't just need one IfController.
>  I still have one week, I would try to find out how the IfController works

That's my point - you don't really need to know how the If Controller
works; just change the code that decides whether or not to run its
children to include whatever additional checks need to be made.

However, it's still not clear to me why the If Controller is
unsuitable, given that it can process an arbitrary condition using
either Javascript or any other function or variable.

>  Many thanks for the help
>
> regards
>
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>
> Sent: Monday, April 20, 2009 4:01:26 AM
>
> Subject: Re: Having problem extending Controller
>
>  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > Thanks for the reply
>  >  I tried IfController. But I have too many complicated conditions to check before executing the sample.
>
>  Such as?
>
>  If you really want to write your own code, then the best way to go
>  would probably be to take a copy of If Controller and amend the part
>  that checks the condition, rather than starting afresh. That should be
>  a lot easier.
>
>  >  I am doing web service testing.
>  >  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  >  Can you please help me?
>  >  regards
>  >
>  >
>  >
>  >
>  >  ________________________________
>  >  From: sebb <se...@gmail.com>
>  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >  Sent: Sunday, April 19, 2009 4:16:46 PM
>  >  Subject: Re: Having problem extending Controller
>  >
>  >
>  >  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  > Hi,
>  >  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  >  I am developing this on Eclipse IDE
>  >  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>  >
>  >  Why is the If Controller no good?
>  >
>  >  Note that the way the controllers interact is the most complicated
>  >  part of JMeter, so I would avoid going down that route unless you are
>  >  prepared for a lot of hard work.
>  >
>  >  >
>  >  >  Following is the stack trace
>  >  >
>  >  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  >  line number         : 46
>  >  >  -------------------------------
>  >  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >  >
>  >  >
>  >  >  <!--
>  >  >  following is my JMX file
>  >  >  -->
>  >  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >  >   <hashTree>
>  >  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >  >       <stringProp name="TestPlan.comments"></stringProp>
>  >  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >  >         <collectionProp name="Arguments.arguments"/>
>  >  >       </elementProp>
>  >  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >  >     </TestPlan>
>  >  >     <hashTree>
>  >  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >  >           <stringProp name="LoopController.loops">1</stringProp>
>  >  >         </elementProp>
>  >  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >  >       </ThreadGroup>
>  >  >       <hashTree>
>  >  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >  >         <hashTree>
>  >  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >             <intProp name="ActionProcessor.action">1</intProp>
>  >  >             <intProp name="ActionProcessor.target">0</intProp>
>  >  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >           </TestAction>
>  >  >           <hashTree>
>  >  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >               <stringProp name="filename"></stringProp>
>  >  >               <stringProp name="parameters"></stringProp>
>  >  >               <boolProp name="resetInterpreter">false</boolProp>
>  >  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >             </BeanShellPreProcessor>
>  >  >             <hashTree/>
>  >  >           </hashTree>
>  >  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >  >           </EmptyController>
>  >  >           <hashTree>
>  >  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >               <intProp name="ActionProcessor.action">1</intProp>
>  >  >               <intProp name="ActionProcessor.target">0</intProp>
>  >  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >             </TestAction>
>  >  >             <hashTree>
>  >  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >  >                 <stringProp name="parameters"></stringProp>
>  >  >                 <stringProp name="filename"></stringProp>
>  >  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >               </BeanShellPreProcessor>
>  >  >               <hashTree/>
>  >  >             </hashTree>
>  >  >           </hashTree>
>  >  >         </hashTree>
>  >  >       </hashTree>
>  >  >     </hashTree>
>  >  >   </hashTree>
>  >  >  </jmeterTestPlan>
>  >  >
>  >  >
>  >  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


      

Re: Having problem extending Controller

Posted by sebb <se...@gmail.com>.
On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> I have already done that. But I don't just need one IfController.
>  I still have one week, I would try to find out how the IfController works

That's my point - you don't really need to know how the If Controller
works; just change the code that decides whether or not to run its
children to include whatever additional checks need to be made.

However, it's still not clear to me why the If Controller is
unsuitable, given that it can process an arbitrary condition using
either Javascript or any other function or variable.

>  Many thanks for the help
>
> regards
>
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>
> Sent: Monday, April 20, 2009 4:01:26 AM
>
> Subject: Re: Having problem extending Controller
>
>  On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > Thanks for the reply
>  >  I tried IfController. But I have too many complicated conditions to check before executing the sample.
>
>  Such as?
>
>  If you really want to write your own code, then the best way to go
>  would probably be to take a copy of If Controller and amend the part
>  that checks the condition, rather than starting afresh. That should be
>  a lot easier.
>
>  >  I am doing web service testing.
>  >  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  >  Can you please help me?
>  >  regards
>  >
>  >
>  >
>  >
>  >  ________________________________
>  >  From: sebb <se...@gmail.com>
>  >  To: JMeter Users List <jm...@jakarta.apache.org>
>  >  Sent: Sunday, April 19, 2009 4:16:46 PM
>  >  Subject: Re: Having problem extending Controller
>  >
>  >
>  >  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  >  > Hi,
>  >  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  >  I am developing this on Eclipse IDE
>  >  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>  >
>  >  Why is the If Controller no good?
>  >
>  >  Note that the way the controllers interact is the most complicated
>  >  part of JMeter, so I would avoid going down that route unless you are
>  >  prepared for a lot of hard work.
>  >
>  >  >
>  >  >  Following is the stack trace
>  >  >
>  >  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  >  line number         : 46
>  >  >  -------------------------------
>  >  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >  >
>  >  >
>  >  >  <!--
>  >  >  following is my JMX file
>  >  >  -->
>  >  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >  >   <hashTree>
>  >  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >  >       <stringProp name="TestPlan.comments"></stringProp>
>  >  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >  >         <collectionProp name="Arguments.arguments"/>
>  >  >       </elementProp>
>  >  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >  >     </TestPlan>
>  >  >     <hashTree>
>  >  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >  >           <stringProp name="LoopController.loops">1</stringProp>
>  >  >         </elementProp>
>  >  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >  >       </ThreadGroup>
>  >  >       <hashTree>
>  >  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >  >         <hashTree>
>  >  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >             <intProp name="ActionProcessor.action">1</intProp>
>  >  >             <intProp name="ActionProcessor.target">0</intProp>
>  >  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >           </TestAction>
>  >  >           <hashTree>
>  >  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >               <stringProp name="filename"></stringProp>
>  >  >               <stringProp name="parameters"></stringProp>
>  >  >               <boolProp name="resetInterpreter">false</boolProp>
>  >  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >             </BeanShellPreProcessor>
>  >  >             <hashTree/>
>  >  >           </hashTree>
>  >  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >  >           </EmptyController>
>  >  >           <hashTree>
>  >  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >  >               <intProp name="ActionProcessor.action">1</intProp>
>  >  >               <intProp name="ActionProcessor.target">0</intProp>
>  >  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >  >             </TestAction>
>  >  >             <hashTree>
>  >  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >  >                 <stringProp name="parameters"></stringProp>
>  >  >                 <stringProp name="filename"></stringProp>
>  >  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >  >               </BeanShellPreProcessor>
>  >  >               <hashTree/>
>  >  >             </hashTree>
>  >  >           </hashTree>
>  >  >         </hashTree>
>  >  >       </hashTree>
>  >  >     </hashTree>
>  >  >   </hashTree>
>  >  >  </jmeterTestPlan>
>  >  >
>  >  >
>  >  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Having problem extending Controller

Posted by Prasad Iyer <pr...@ymail.com>.
I have already done that. But I don't just need one IfController.
I still have one week, I would try to find out how the IfController works
Many thanks for the help
regards





________________________________
From: sebb <se...@gmail.com>
To: JMeter Users List <jm...@jakarta.apache.org>
Sent: Monday, April 20, 2009 4:01:26 AM
Subject: Re: Having problem extending Controller

On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Thanks for the reply
>  I tried IfController. But I have too many complicated conditions to check before executing the sample.

Such as?

If you really want to write your own code, then the best way to go
would probably be to take a copy of If Controller and amend the part
that checks the condition, rather than starting afresh. That should be
a lot easier.

>  I am doing web service testing.
>  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  Can you please help me?
>  regards
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>  Sent: Sunday, April 19, 2009 4:16:46 PM
>  Subject: Re: Having problem extending Controller
>
>
>  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > Hi,
>  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  I am developing this on Eclipse IDE
>  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>
>  Why is the If Controller no good?
>
>  Note that the way the controllers interact is the most complicated
>  part of JMeter, so I would avoid going down that route unless you are
>  prepared for a lot of hard work.
>
>  >
>  >  Following is the stack trace
>  >
>  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  line number         : 46
>  >  -------------------------------
>  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >
>  >
>  >  <!--
>  >  following is my JMX file
>  >  -->
>  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >   <hashTree>
>  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >       <stringProp name="TestPlan.comments"></stringProp>
>  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >         <collectionProp name="Arguments.arguments"/>
>  >       </elementProp>
>  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >     </TestPlan>
>  >     <hashTree>
>  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >           <stringProp name="LoopController.loops">1</stringProp>
>  >         </elementProp>
>  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >       </ThreadGroup>
>  >       <hashTree>
>  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >         <hashTree>
>  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >             <intProp name="ActionProcessor.action">1</intProp>
>  >             <intProp name="ActionProcessor.target">0</intProp>
>  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >           </TestAction>
>  >           <hashTree>
>  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >               <stringProp name="filename"></stringProp>
>  >               <stringProp name="parameters"></stringProp>
>  >               <boolProp name="resetInterpreter">false</boolProp>
>  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >             </BeanShellPreProcessor>
>  >             <hashTree/>
>  >           </hashTree>
>  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >           </EmptyController>
>  >           <hashTree>
>  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >               <intProp name="ActionProcessor.action">1</intProp>
>  >               <intProp name="ActionProcessor.target">0</intProp>
>  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >             </TestAction>
>  >             <hashTree>
>  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >                 <stringProp name="parameters"></stringProp>
>  >                 <stringProp name="filename"></stringProp>
>  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >               </BeanShellPreProcessor>
>  >               <hashTree/>
>  >             </hashTree>
>  >           </hashTree>
>  >         </hashTree>
>  >       </hashTree>
>  >     </hashTree>
>  >   </hashTree>
>  >  </jmeterTestPlan>
>  >
>  >
>  >
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


      

Re: Having problem extending Controller

Posted by sebb <se...@gmail.com>.
On 20/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Thanks for the reply
>  I tried IfController. But I have too many complicated conditions to check before executing the sample.

Such as?

If you really want to write your own code, then the best way to go
would probably be to take a copy of If Controller and amend the part
that checks the condition, rather than starting afresh. That should be
a lot easier.

>  I am doing web service testing.
>  I spend around 2 days fiddling with JMeter before asking a question on mailing list.
>  Can you please help me?
>  regards
>
>
>
>
>  ________________________________
>  From: sebb <se...@gmail.com>
>  To: JMeter Users List <jm...@jakarta.apache.org>
>  Sent: Sunday, April 19, 2009 4:16:46 PM
>  Subject: Re: Having problem extending Controller
>
>
>  On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
>  > Hi,
>  >  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  >  I am developing this on Eclipse IDE
>  >  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.
>
>  Why is the If Controller no good?
>
>  Note that the way the controllers interact is the most complicated
>  part of JMeter, so I would avoid going down that route unless you are
>  prepared for a lot of hard work.
>
>  >
>  >  Following is the stack trace
>  >
>  >  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  >  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  >  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  >  class               : org.apache.jmeter.save.ScriptWrapper
>  >  required-type       : org.apache.jorphan.collections.ListedHashTree
>  >  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  >  line number         : 46
>  >  -------------------------------
>  >  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>  >         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>  >         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>  >         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>  >         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>  >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  >         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>  >         at java.lang.reflect.Method.invoke(Method.java:597)
>  >         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>  >
>  >
>  >  <!--
>  >  following is my JMX file
>  >  -->
>  >  <?xml version="1.0" encoding="UTF-8"?>
>  >  <jmeterTestPlan version="1.2" properties="2.1">
>  >   <hashTree>
>  >     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>  >       <stringProp name="TestPlan.comments"></stringProp>
>  >       <boolProp name="TestPlan.functional_mode">false</boolProp>
>  >       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>  >       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>  >         <collectionProp name="Arguments.arguments"/>
>  >       </elementProp>
>  >       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>  >     </TestPlan>
>  >     <hashTree>
>  >       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>  >         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>  >           <boolProp name="LoopController.continue_forever">false</boolProp>
>  >           <stringProp name="LoopController.loops">1</stringProp>
>  >         </elementProp>
>  >         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>  >         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>  >         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>  >         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>  >         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>  >         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>  >         <stringProp name="ThreadGroup.duration"></stringProp>
>  >         <stringProp name="ThreadGroup.delay"></stringProp>
>  >       </ThreadGroup>
>  >       <hashTree>
>  >         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>  >         <hashTree>
>  >           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >             <intProp name="ActionProcessor.action">1</intProp>
>  >             <intProp name="ActionProcessor.target">0</intProp>
>  >             <stringProp name="ActionProcessor.duration"></stringProp>
>  >           </TestAction>
>  >           <hashTree>
>  >             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >               <stringProp name="filename"></stringProp>
>  >               <stringProp name="parameters"></stringProp>
>  >               <boolProp name="resetInterpreter">false</boolProp>
>  >               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  >  System.out.println(&quot;hello world&quot;);</stringProp>
>  >             </BeanShellPreProcessor>
>  >             <hashTree/>
>  >           </hashTree>
>  >           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>  >             <stringProp name="EmptyController.condition">str</stringProp>
>  >           </EmptyController>
>  >           <hashTree>
>  >             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>  >               <intProp name="ActionProcessor.action">1</intProp>
>  >               <intProp name="ActionProcessor.target">0</intProp>
>  >               <stringProp name="ActionProcessor.duration"></stringProp>
>  >             </TestAction>
>  >             <hashTree>
>  >               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>  >                 <boolProp name="resetInterpreter">true</boolProp>
>  >                 <stringProp name="parameters"></stringProp>
>  >                 <stringProp name="filename"></stringProp>
>  >                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>  >               </BeanShellPreProcessor>
>  >               <hashTree/>
>  >             </hashTree>
>  >           </hashTree>
>  >         </hashTree>
>  >       </hashTree>
>  >     </hashTree>
>  >   </hashTree>
>  >  </jmeterTestPlan>
>  >
>  >
>  >
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Having problem extending Controller

Posted by Prasad Iyer <pr...@ymail.com>.
Thanks for the reply
I tried IfController. But I have too many complicated conditions to check before executing the sample. I am doing web service testing.
I spend around 2 days fiddling with JMeter before asking a question on mailing list. 
Can you please help me? 
regards




________________________________
From: sebb <se...@gmail.com>
To: JMeter Users List <jm...@jakarta.apache.org>
Sent: Sunday, April 19, 2009 4:16:46 PM
Subject: Re: Having problem extending Controller

On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Hi,
>  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  I am developing this on Eclipse IDE
>  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.

Why is the If Controller no good?

Note that the way the controllers interact is the most complicated
part of JMeter, so I would avoid going down that route unless you are
prepared for a lot of hard work.

>
>  Following is the stack trace
>
>  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  class               : org.apache.jmeter.save.ScriptWrapper
>  required-type       : org.apache.jorphan.collections.ListedHashTree
>  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  line number         : 46
>  -------------------------------
>  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>
>
>  <!--
>  following is my JMX file
>  -->
>  <?xml version="1.0" encoding="UTF-8"?>
>  <jmeterTestPlan version="1.2" properties="2.1">
>   <hashTree>
>     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>       <stringProp name="TestPlan.comments"></stringProp>
>       <boolProp name="TestPlan.functional_mode">false</boolProp>
>       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>         <collectionProp name="Arguments.arguments"/>
>       </elementProp>
>       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>     </TestPlan>
>     <hashTree>
>       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>           <boolProp name="LoopController.continue_forever">false</boolProp>
>           <stringProp name="LoopController.loops">1</stringProp>
>         </elementProp>
>         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>         <stringProp name="ThreadGroup.duration"></stringProp>
>         <stringProp name="ThreadGroup.delay"></stringProp>
>       </ThreadGroup>
>       <hashTree>
>         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>         <hashTree>
>           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>             <intProp name="ActionProcessor.action">1</intProp>
>             <intProp name="ActionProcessor.target">0</intProp>
>             <stringProp name="ActionProcessor.duration"></stringProp>
>           </TestAction>
>           <hashTree>
>             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>               <stringProp name="filename"></stringProp>
>               <stringProp name="parameters"></stringProp>
>               <boolProp name="resetInterpreter">false</boolProp>
>               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  System.out.println(&quot;hello world&quot;);</stringProp>
>             </BeanShellPreProcessor>
>             <hashTree/>
>           </hashTree>
>           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>             <stringProp name="EmptyController.condition">str</stringProp>
>           </EmptyController>
>           <hashTree>
>             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>               <intProp name="ActionProcessor.action">1</intProp>
>               <intProp name="ActionProcessor.target">0</intProp>
>               <stringProp name="ActionProcessor.duration"></stringProp>
>             </TestAction>
>             <hashTree>
>               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>                 <boolProp name="resetInterpreter">true</boolProp>
>                 <stringProp name="parameters"></stringProp>
>                 <stringProp name="filename"></stringProp>
>                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>               </BeanShellPreProcessor>
>               <hashTree/>
>             </hashTree>
>           </hashTree>
>         </hashTree>
>       </hashTree>
>     </hashTree>
>   </hashTree>
>  </jmeterTestPlan>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


      

Re: Having problem extending Controller

Posted by sebb <se...@gmail.com>.
On 19/04/2009, Prasad Iyer <pr...@ymail.com> wrote:
> Hi,
>  I have created a EmptyController.java which extends the GenericController. To test a value of the variable. If the variable is empty I don't want to execute the Sample.
>  I am developing this on Eclipse IDE
>  My problem is JMeter is throwing an exception. I don't know why JMeter is not finding the class. Can anyone please help me? I tried using IfController. But It won't serve my purpose. As I am going to add lot of validation in this class.

Why is the If Controller no good?

Note that the way the controllers interact is the most complicated
part of JMeter, so I would avoid going down that route unless you are
prepared for a lot of hard work.

>
>  Following is the stack trace
>
>  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
>  cause-message       : EmptyController : EmptyController : EmptyController : EmptyController
>  first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:87)
>  class               : org.apache.jmeter.save.ScriptWrapper
>  required-type       : org.apache.jorphan.collections.ListedHashTree
>  path                : /jmeterTestPlan/hashTree/hashTree/hashTree/hashTree/EmptyController
>  line number         : 46
>  -------------------------------
>  2009/04/18 20:40:20 ERROR - jmeter.JMeter:  java.lang.NullPointerException
>         at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:91)
>         at org.apache.jmeter.JMeter.run(JMeter.java:728)
>         at org.apache.jmeter.JMeter.startNonGui(JMeter.java:706)
>         at org.apache.jmeter.JMeter.start(JMeter.java:361)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.jmeter.NewDriver.main(NewDriver.java:210)
>
>
>  <!--
>  following is my JMX file
>  -->
>  <?xml version="1.0" encoding="UTF-8"?>
>  <jmeterTestPlan version="1.2" properties="2.1">
>   <hashTree>
>     <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
>       <stringProp name="TestPlan.comments"></stringProp>
>       <boolProp name="TestPlan.functional_mode">false</boolProp>
>       <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
>       <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
>         <collectionProp name="Arguments.arguments"/>
>       </elementProp>
>       <stringProp name="TestPlan.user_define_classpath"></stringProp>
>     </TestPlan>
>     <hashTree>
>       <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
>         <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
>           <boolProp name="LoopController.continue_forever">false</boolProp>
>           <stringProp name="LoopController.loops">1</stringProp>
>         </elementProp>
>         <stringProp name="ThreadGroup.num_threads">1</stringProp>
>         <stringProp name="ThreadGroup.ramp_time">1</stringProp>
>         <longProp name="ThreadGroup.start_time">1240084414000</longProp>
>         <longProp name="ThreadGroup.end_time">1240084414000</longProp>
>         <boolProp name="ThreadGroup.scheduler">false</boolProp>
>         <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
>         <stringProp name="ThreadGroup.duration"></stringProp>
>         <stringProp name="ThreadGroup.delay"></stringProp>
>       </ThreadGroup>
>       <hashTree>
>         <GenericController guiclass="LogicControllerGui" testclass="GenericController" testname="Simple Controller" enabled="true"/>
>         <hashTree>
>           <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>             <intProp name="ActionProcessor.action">1</intProp>
>             <intProp name="ActionProcessor.target">0</intProp>
>             <stringProp name="ActionProcessor.duration"></stringProp>
>           </TestAction>
>           <hashTree>
>             <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>               <stringProp name="filename"></stringProp>
>               <stringProp name="parameters"></stringProp>
>               <boolProp name="resetInterpreter">false</boolProp>
>               <stringProp name="script">vars.put(&quot;str&quot;, &quot;dis&quot;);
>  System.out.println(&quot;hello world&quot;);</stringProp>
>             </BeanShellPreProcessor>
>             <hashTree/>
>           </hashTree>
>           <EmptyController testclass="EmptyController" testname="Empty Controller" enabled="true">
>             <stringProp name="EmptyController.condition">str</stringProp>
>           </EmptyController>
>           <hashTree>
>             <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Test Action" enabled="true">
>               <intProp name="ActionProcessor.action">1</intProp>
>               <intProp name="ActionProcessor.target">0</intProp>
>               <stringProp name="ActionProcessor.duration"></stringProp>
>             </TestAction>
>             <hashTree>
>               <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
>                 <boolProp name="resetInterpreter">true</boolProp>
>                 <stringProp name="parameters"></stringProp>
>                 <stringProp name="filename"></stringProp>
>                 <stringProp name="script">System.out.println(&quot;hello world&quot;);</stringProp>
>               </BeanShellPreProcessor>
>               <hashTree/>
>             </hashTree>
>           </hashTree>
>         </hashTree>
>       </hashTree>
>     </hashTree>
>   </hashTree>
>  </jmeterTestPlan>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org