Sorry, my bad. Mike is right.

The GUI does indeed need to create an instance of the relevant Sampler
in createTestElement().

However, beware of doing things in the GUI that are needed at
run-time, or there may be problems when run in non-GUI mode. A year or
so back there was such a problem - if I recall correctly, the GUI was
doing a calculation that was needed by the sampler; this was never
done in non-GUI mode.

Just done some experiments by adding some debug prints to BSH GUI:
It appears that createTestElement() is only called when adding a test
element to the TestPlan. It is not called when running a test, nor
when loading a saved test plan.  Strangely, it's not called when a
test element is copied and pasted back into the test plan.

Even configure() and modifyTestElement() are not called when running a
test - they are called only during initial load of a test plan and
when the GUI item is selected and deselected in the display.

The Samplers themselves are also instantiated anew when the test is
started - every thread gets its own instance of each of the samplers
in the test plan. So samplers don't need to worry about being run from
multiple threads (unlike functions).

But they do need to worry about where to get their variables - these
need to be retrieved from the JMeterProperties.

HTH - sorry about my earlier mistake ...

On Tue, 18 Jan 2005 18:46:39 -0500, Michael Stover <[EMAIL PROTECTED]> wrote:
> Actually, createTestElement is precisely where the element should be
> created, and you can run into problems if you do not create a new one
> with each call to this method.
> 
> I suspect the real problem lies elsewhere - maybe the sampler being made
> here isn't using the properties map from AbstractTestElement?  If data
> is being stored in instance variables, that won't work unless it
> implements TestBean too.
> 
> -Mike
> 
> On Tue, 2005-01-18 at 14:59, sebb wrote:
> > On Mon, 17 Jan 2005 16:39:43 -0600, Anil Philip
> > <[EMAIL PROTECTED]> wrote:
> > > I am writing a CorbaSampler (aka TCPSampler()).
> > >
> > > In my SamplerGUI, am I creating the sampler in the correct place?
> >
> > I don't think so.
> >
> > GUI sampler classes should only do what is necessary to ensure that
> > the display agrees with the test element.
> >
> > They should not create anything needed by the sampler, otherwise the
> > sampler won't work in non-GUI mode...
> >
> > >    public TestElement createTestElement()
> > >
> > >     {
> > >
> > >         CorbaSampler sampler = new CorbaSampler();
> > >
> > >         modifyTestElement(sampler);
> > >
> > >         return sampler;
> > >
> > >     }
> > >
> > > However I find that createTestElement() is indirectly called from several
> > > places by JMeter (26 places!).
> > >
> > > So after I initially create JMeter, I set some data in it. In the sample()
> > > call, I try to retrieve the data but find that a *new* instance of
> > > CorbaSampler() has been created! So that now my data is lost.
> >
> > Not surprising ...!
> >
> > > Thanks,
> > >
> > > Anil Philip
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> -- 
> Michael Stover <[EMAIL PROTECTED]>
> Apache Software Foundation
> 
> 
> ---------------------------------------------------------------------
> 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