I downloaded the 20030331 build.  I have a test plan that has 1 thread
but loops three times. 
The order of setupTest(), runTest(), and teardownTest() is interesting: 

BookCreationSampler.setupTest(JavaSamplerContext javaSamplerContext) 
BookCreationSampler.runTest(JavaSamplerContext javaSamplerContext) 
BookCreationSampler.createBook() 
BookCreationSampler.setupTest(JavaSamplerContext javaSamplerContext) 
BookCreationSampler.runTest(HashMap) 
BookCreationSampler.createBook() 
BookCreationSampler.setupTest(JavaSamplerContext javaSamplerContext) 
BookCreationSampler.runTest(HashMap) 
BookCreationSampler.createBook() 
BookCreationSampler.teardownTest() 
BookCreationSampler.teardownTest() 
BookCreationSampler.teardownTest() 

Note that createBook() is called within runTest().  Why is setupTest()
being called before each loop, but teardownTest() called is after the
all the loops have completed?  I guess I was expected the JUnit paradigm
of setUp(), test(), tearDown().

-----Original Message----- 
From: Jeremy Arnold [ mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] 
Sent: Thursday, April 03, 2003 1:35 PM 
To: JMeter Users List 
Subject: Re: JavaSampler.teardownTest() not being called 


Hello, 
    The JavaSampler was broken in 1.8.1 (and earlier versions -- I don't

know the whole history, but I don't think it has ever worked quite the 
way you would expect it to).  The good news is that it has been fixed in

the last month or so.  So if you're willing to use a recent nightly 
build or pull it from CVS then it should work for you. 

    Note, however, that the API has also changed a bit, so you'll have 
to make a few modifications to your JavaSamplerClient implementation.  
They are pretty simple changes though.  Take a look at the new 
org.apache.jmeter.protocol.java.test.SleepTest code and the JavaDoc for 
some tips on how to do it.  Finally, you shouldn't have been extending 
JavaSampler (not that it would have made a difference).  So you will 
need to change it to extend the new AbstractJavaSamplerClient (or 
implement the JavaSamplerClient interface directly). 

    Let me know if you have any questions. 

Jeremy 

Gardner, Chris wrote: 

>In jmeter 1.8.1 on Windows 2K, I've created a class that extends 
>JavaSampler to call a Java object.  I overrode teardownTest() to remove

>the data from a database that the called Java object effectively 
>inserted.  Unfortunately, teardownTest() is not being called.  What am
I 
>doing wrong? 
> 
>Thanks. 
> 
>Chris Gardner 
> 
> 
>  
> 



--------------------------------------------------------------------- 
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 

Reply via email to