Actually, the tutorial (http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf) does not mention that setUp() has to be public.

OK, I entered http://issues.apache.org/bugzilla/show_bug.cgi?id=41446

Debugging was actually a bit difficult as I could not simply run jmeter as part of my Eclipse project as jmeter does some magic loading its classes so I had to remote debug.
But never mind, I learned something ;-)

Thanks for a great tool,
Jürgen

Peter Lin wrote:
the tutorial on the JUnit sampler states the setup and teardown method need
to be public. please open a bugzilla to enhance the user manual.

sorry you had to waste time debugging your test. it's generally better to
make the setup, teardown, onetimesetup and onetimeteardown public methods.

peter

On 1/23/07, Jürgen Weber <[EMAIL PROTECTED]> wrote:

Hi,

several JUnit tutorials (inclusive the sample at
http://junit.sourceforge.net/javadoc/junit/framework/TestCase.html) show a

protected void setUp()

method.


The JUnitSampler looks for the setUp() method using getMethod() but this
finds only __public__ methods. So when you have a protected setUp() in
your testcase, JUnitSampler will almost silently not call it, there is
only a harmless log line:

2007/01/23 13:18:11 WARN  - jmeter.protocol.java.sampler.JUnitSampler:
unittest.UnitTestClientImpl.setUp()

try {
                return clazz.getClass().getMethod(method,new Class[0]);
            } catch (NoSuchMethodException e) {
                log.warn(e.getMessage());
            }

I think it were better if there was a [x] call setUp() and tearDown() on
the gui and throw an exception if there is none or not found.

It cost me quite some time and remote debugging to find out, why my
setUp() was not called.

Jürgen


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





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

Reply via email to