问题
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.
回答1:
you could also look at gridinit-dsl language for jmeter. It uses ruby to generate the xml.
回答2:
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.
来源:https://stackoverflow.com/questions/17020274/api-for-generating-jmeter-test-plans