1

I would like to programmatically generate basic Jmeter test plans from a dynamic set of URLs and form data (not using the Jmeter GUI manually). Can I use the Jmeter API to do this?
Is it already explained somewhere?
I just need point to start from.

Of course I could reverse engineer the test plan XML format and then write my own custom test plan generator, but that's error prone and whenever the format changes my generator needs to be updated.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
Jack
  • 1,881
  • 24
  • 29
  • Any feedback on that ? – UBIK LOAD PACK Jun 13 '13 at 20:06
  • As I'm new to Jmeter I'm not sure how flexible this is and where I can use CSV variables in a testplan (everything? everywhere?). I think it's a good suggestion. However, I'm really looking for a way to create testplans without a GUI and any manual actions, i.e. only using code. In a perfect world, I'd love to see something like this: `TestPlan tp = new TestPlan(); ThreadGroup tg = new ThreadGroup(); tg.setLoops(100); tg.setNumThreads(10); tg.setRampTime(1); tp.appendChild(tg);`. For now, I'm using XOM to generate XML that matches Jmeter's .jmx format. I will see how far I get with this. – Jack Jun 29 '13 at 07:55

2 Answers2

2

you could also look at gridinit-dsl language for jmeter. It uses ruby to generate the xml.

girlytech59
  • 408
  • 2
  • 6
  • It's now called "ruby-jmeter" - https://github.com/flood-io/ruby-jmeter - you could in theory call it from Java via JRuby, or reverse engineer it. It doesn't seem to use any sort of api, it just generates xml by hand. – Korny Oct 08 '14 at 17:55
0

From what you explain, have a look at CSV DataSet which will read urls from csv file.

This component will Iterate on file and put one line in a set of variables, in your case 1 varirable called "URL" for example.

Then you can use ${URL} in HTTP Sampler and set number of iterations and threads in Thread Group to loop and put the load on different urls.

Use hc31impl or java impl if you hit different hosts.

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116