On 1 July 2014 08:22, Sam Drew <sam.d...@forgerock.com> wrote: > I’m trying to write a custom JMeter module, that will run a Java method that > I use for Server Setup and returns Map<String,String> as configuration > properties that can be used in sampling.
How are you going to use the Map? Why are the exsisting facilities for providing input to threads not sufficient? For example, http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config http://jmeter.apache.org/usermanual/functions.html#__StringFromFile > At the moment I am slightly unsure of what TestElement I should be extending > or implementing in order to achieve this, given that it seems to sit > somewhere between a PreProcessor and ConfigTestElement, in that it is both > setting up pre-conditions for the test and then providing these as > configuration parameters. > > After looking at the example in jmeter-plugins for csv config element I wrote > a class which was little more than > > class CreateMyServerConfig extends Arguments { > @Override > public Map<String, String> getArgumentsAsMap() { > return ServerInstance.getServerInstance().getPropertiesAsMap(); > } > } > > Where getServerInstance would first generate a VM Instance and later just > provide a reference to the one created. When I tried to run a test plan with > it in the code never appeared to be executed, and I never really knew what to > expect. And whether/when this code might be called (particularly as I only > really want it run once). > > I was hoping that someone might be able to tell me which path to follow, > whether I’m barking up the wrong tree and which resources might be helpful. I > have looked at https://jmeter.apache.org/extending/jmeter_tutorial.pdf, have > seen various information relating to building custom samplers, and have even > used the Java Request Sampler in the past, however this has me completely > stumped. > > Alternatively a way to deal with JMeter’s configuration such that I could > embed JMeter in a jar and load the config from classpath would allow me to > run the code manually before starting JMeter from within Java. > > Thanks, > > Sam. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org For additional commands, e-mail: user-h...@jmeter.apache.org