okay, will do. The version I have is 2.1.1 -----Original Message----- From: Peter Lin [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 23, 2005 11:43 AM To: JMeter Users List Subject: Re: JMeter JUnit sampler - how to use oneTimeSetup
which version are you using. there was a bug in the older version. please try a nightly, it should be fixed. peter On 11/23/05, Krishnasankar R <[EMAIL PROTECTED]> wrote: > > Yes, I did create a separate threadgroup and made this the first one > as you suggested. The relevant test code and JMX are present in the > earlier post. There were no errors. Sorry if this was not apparent. > > -----Original Message----- > From: Peter Lin [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 23, 2005 10:36 AM > To: JMeter Users List > Subject: Re: JMeter JUnit sampler - how to use oneTimeSetup > > > did you set the test plan to run each thread group separately? > > if you didn't the call to oneTimeSetUp/oneTimeTearDown may not run > before other methods like setUp/tearDown. you're previous post didn't > include any information on the error you see. > > if there is an error in jmeter.log, please post it. it's kind of hard > to diagnose the problem without additional information. > > peter > > On 11/22/05, Krishnasankar R <[EMAIL PROTECTED]> > wrote: > > > > Do people work around this issue or is it that I'm making a mistake > > somewhere. > > > > -----Original Message----- > > From: Krishnasankar R [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 16, 2005 12:18 PM > > To: JMeter Users List > > Subject: RE: JMeter JUnit sampler - how to use oneTimeSetup > > > > > > Thanks for your response, Lin. > > > > Peter Lin: "basically, to use oneTimeSetup, you have to create a > > threadgroup and place all your oneTimeSetUp calls in that thread > > group. the threadGroup should be at the top and only run once with 1 > > thread. Then the actual > test > > methods should be placed in a separate thread group. > > > > when you select 'oneTimeSetUp' as the test method, you have to make > > sure to check 'do not call setUp'. Since JMeter is a multi-threaded > > environment, it's necessary to place oneTimeSetUp/oneTimeTearDown in > > a threadgroup with 1 thread and 1 iteration." > > > > I created a test plan as specified above, but the problem persists. > > Please find below the test plan and the JUnit testcase. Am I missing > > something? > > > > import junit.framework.Test; > > import junit.framework.TestCase; > > import junit.framework.TestSuite; > > > > public class SimpleTestClient extends TestCase { > > /* Test oneTimeSetUp */ > > > > private int oneTimeValue; > > > > /** Default constructor */ > > public SimpleTestClient() { > > super(); > > } > > > > /** Constructor */ > > public SimpleTestClient(String name) { > > super(name); > > } > > > > public void setUp() { > > System.out.println("In setUp()"); > > } > > > > public void tearDown() { > > System.out.println("In tearDown()"); > > } > > > > public void oneTimeSetUp() { > > System.out.println("oneTimeSetUp called -- "); > > oneTimeValue=5; > > System.out.println("In oneTimeSetUp: oneTimeValue: " > > + oneTimeValue); > > } > > > > public void oneTimeTearDown() { > > System.out.println("oneTimeTearDown called -- "); > > } > > > > /** > > * Test oneTimeSetUp > > */ > > public void testMethod() { > > System.out.println("In testMethod: oneTimeValue: " + > > oneTimeValue); > > } > > > > } // class > > > > JMX: > > > > <jmeterTestPlan version="1.1" properties="1.7"> > > <hashTree> > > <TestPlan> > > <elementProp name="TestPlan.user_defined_variables" > > elementType="org.apache.jmeter.config.Arguments"> > > <stringProp > > name="TestElement.gui_class">org.apache.jmeter.config.gui.ArgumentsP > > an > > el > > </st > > ringProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.config.Arguments > > </stringProp > > > > > <collectionProp name="Arguments.arguments"/> > > <stringProp name="TestElement.name">User Defined > > Variables</stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > </elementProp> > > <stringProp > > name="TestElement.gui_class">org.apache.jmeter.control.gui.TestPlanG > > ui > > </stri > > ngProp> > > <stringProp name="TestPlan.user_define_classpath"></stringProp> > > <boolProp name="TestPlan.serialize_threadgroups">false</boolProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.testelement.TestPlan > > </string > > Prop> > > <stringProp name="TestElement.name">Test Plan</stringProp> > > <boolProp name="TestPlan.functional_mode">false</boolProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <stringProp name="TestPlan.comments"></stringProp> > > </TestPlan> > > <hashTree> > > <ThreadGroup> > > <longProp name="ThreadGroup.start_time">1132115191000</longProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup > > </stringP > > rop> > > <stringProp name="ThreadGroup.delay"></stringProp> > > <stringProp name="ThreadGroup.duration"></stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <stringProp name="ThreadGroup.num_threads">1</stringProp> > > <boolProp name="ThreadGroup.scheduler">false</boolProp> > > <stringProp > > name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGro > > up > > Gui > > </s > > tringProp> > > <elementProp name="ThreadGroup.main_controller" > > elementType="org.apache.jmeter.control.LoopController"> > > <stringProp > > name="TestElement.gui_class"> > > org.apache.jmeter.control.gui.LoopControlPanel< > > /stringProp> > > <stringProp name="LoopController.loops">1</stringProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.control.LoopControll > > er > > </stri > > ngProp> > > <stringProp name="TestElement.name">Loop > Controller</stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <boolProp name="LoopController.continue_forever > > ">false</boolProp> > > </elementProp> > > <stringProp name="TestElement.name">One time setup</stringProp> > > <longProp name="ThreadGroup.end_time">1132115191000</longProp> > > <stringProp name="ThreadGroup.on_sample_error > > ">continue</stringProp> > > <stringProp name="ThreadGroup.ramp_time">1</stringProp> > > </ThreadGroup> > > <hashTree> > > <org.apache.jmeter.protocol.java.sampler.JUnitSampler> > > <stringProp name="junitsampler.failure">Test > failed</stringProp> > > <stringProp > > name="TestElement.test_class"> > > org.apache.jmeter.protocol.java.sampler.JUnitS > > ampler</stringProp> > > <stringProp name="junitsampler.success.code">1000</stringProp> > > <stringProp name="junitsampler.failure.code">0001</stringProp> > > <stringProp name="junitsampler.pkg.filter"></stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <stringProp name="junitsampler.exec.setup">true</stringProp> > > <stringProp name="junitsampler.method > ">oneTimeSetUp</stringProp> > > <stringProp name="junitsampler.success">Test > > successful</stringProp> > > <stringProp > > name="TestElement.gui_class"> > > org.apache.jmeter.protocol.java.control.gui.JUn > > itTestSamplerGui</stringProp> > > <stringProp name="junitsampler.constructorstring > "></stringProp> > > <stringProp name="TestElement.name">OneTimeSetup</stringProp> > > <stringProp > > name="junitSampler.classname">SimpleTestClient</stringProp> > > </org.apache.jmeter.protocol.java.sampler.JUnitSampler> > > <hashTree/> > > </hashTree> > > <ThreadGroup> > > <longProp name="ThreadGroup.start_time">1132115191000</longProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.threads.ThreadGroup > > </stringP > > rop> > > <stringProp name="ThreadGroup.delay"></stringProp> > > <stringProp name="ThreadGroup.duration"></stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <stringProp name="ThreadGroup.num_threads">1</stringProp> > > <boolProp name="ThreadGroup.scheduler">false</boolProp> > > <stringProp > > name="TestElement.gui_class">org.apache.jmeter.threads.gui.ThreadGro > > up > > Gui > > </s > > tringProp> > > <elementProp name="ThreadGroup.main_controller" > > elementType="org.apache.jmeter.control.LoopController"> > > <stringProp > > name="TestElement.gui_class"> > > org.apache.jmeter.control.gui.LoopControlPanel< > > /stringProp> > > <stringProp name="LoopController.loops">1</stringProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.control.LoopControll > > er > > </stri > > ngProp> > > <stringProp name="TestElement.name">Loop > Controller</stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <boolProp name="LoopController.continue_forever > > ">false</boolProp> > > </elementProp> > > <stringProp name="TestElement.name">Test</stringProp> > > <longProp name="ThreadGroup.end_time">1132115191000</longProp> > > <stringProp name="ThreadGroup.on_sample_error > > ">continue</stringProp> > > <stringProp name="ThreadGroup.ramp_time">1</stringProp> > > </ThreadGroup> > > <hashTree> > > <org.apache.jmeter.protocol.java.sampler.JUnitSampler> > > <stringProp name="junitsampler.failure">Test > failed</stringProp> > > <stringProp > > name="TestElement.test_class"> > > org.apache.jmeter.protocol.java.sampler.JUnitS > > ampler</stringProp> > > <stringProp name="junitsampler.success.code">1000</stringProp> > > <stringProp name="junitsampler.failure.code">0001</stringProp> > > <stringProp name="junitsampler.pkg.filter"></stringProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <stringProp name="junitsampler.exec.setup">false</stringProp> > > <stringProp name="junitsampler.method">testMethod</stringProp> > > <stringProp name="junitsampler.success">Test > > successful</stringProp> > > <stringProp > > name="TestElement.gui_class"> > > org.apache.jmeter.protocol.java.control.gui.JUn > > itTestSamplerGui</stringProp> > > <stringProp name="junitsampler.constructorstring > "></stringProp> > > <stringProp name="TestElement.name">JUnit Request</stringProp> > > <stringProp > > name="junitSampler.classname">SimpleTestClient</stringProp> > > </org.apache.jmeter.protocol.java.sampler.JUnitSampler> > > <hashTree/> > > </hashTree> > > <ResultCollector> > > <stringProp > > name="TestElement.gui_class">org.apache.jmeter.visualizers.TableVisu > > al > > izer > > </ > > stringProp> > > <stringProp > > name="TestElement.test_class">org.apache.jmeter.reporters.ResultColl > > ec > > tor > > </s > > tringProp> > > <stringProp name="TestElement.name">View Results in > > Table</stringProp> > > <objProp> > > <value > > class="org.apache.jmeter.samplers.SampleSaveConfiguration > > "> > > <time>true</time> > > <latency>true</latency> > > <timestamp>true</timestamp> > > <success>true</success> > > <label>true</label> > > <code>true</code> > > <message>true</message> > > <threadName>true</threadName> > > <dataType>true</dataType> > > <encoding>false</encoding> > > <assertions>true</assertions> > > <subresults>true</subresults> > > <responseData>false</responseData> > > <samplerData>false</samplerData> > > <xml>true</xml> > > <fieldNames>false</fieldNames> > > <responseHeaders>false</responseHeaders> > > <requestHeaders>false</requestHeaders> > > <responseDataOnError>false</responseDataOnError> > > > > > > <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailu > > re > > Messag > > e> > > <assertionsResultsToSave>0</assertionsResultsToSave> > > <delimiter>,</delimiter> > > <printMilliseconds>true</printMilliseconds> > > </value> > > <name>saveConfig</name> > > </objProp> > > <boolProp name="TestElement.enabled">true</boolProp> > > <stringProp > > name="filename">d:\source\jmeter\OneTimeSetup.out</stringProp> > > <boolProp name="ResultCollector.error_logging">false</boolProp> > > </ResultCollector> > > <hashTree/> > > </hashTree> > > </hashTree> > > </jmeterTestPlan> > > > > Thanks, > > Krishna > > > > ******************************************************************** > > ** > > ****** > > This communication contains information, which is confidential and may > > also > > be privileged. It is for the exclusive use of the intended recipient(s). > > If > > you are not the intended recipient(s), please note that any > distribution, > > printing, copying or use of this communication or the information in > > it > is > > strictly prohibited. If you have received this communication in > > error, please notify the sender immediately and then destroy any > > copies of it. > > > > ******************************************************************** > > ** > > ****** > > > > -------------------------------------------------------------------- > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > ******************************************************************** > > ** > > ****** > > This communication contains information, which is confidential and may > > also > > be privileged. It is for the exclusive use of the intended recipient(s). > > If > > you are not the intended recipient(s), please note that any > distribution, > > printing, copying or use of this communication or the information in > > it > is > > strictly prohibited. If you have received this communication in > > error, please notify the sender immediately and then destroy any > > copies of it. > > > > ******************************************************************** > > ** > > ****** > > > > -------------------------------------------------------------------- > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > ********************************************************************** > ****** > This communication contains information, which is confidential and may > also > be privileged. It is for the exclusive use of the intended recipient(s). > If > you are not the intended recipient(s), please note that any distribution, > printing, copying or use of this communication or the information in it is > strictly prohibited. If you have received this communication in error, > please notify the sender immediately and then destroy any copies of it. > > ********************************************************************** > ****** > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > **************************************************************************** This communication contains information, which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s), please note that any distribution, printing, copying or use of this communication or the information in it is strictly prohibited. If you have received this communication in error, please notify the sender immediately and then destroy any copies of it. **************************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

