After watching the excellent presentation on performance testing given by Goranka Bjedov (QA Engineer at Google), my interest on JMeter increased exponentially. Planning for some testing of InfoQ upcoming features (oh yes, we have some surprises on our bag for this beginning of the year) I have giving it a try.
It took me a while to identify the elements involved while creating a scenario (by the way: JMeter name for scenarios: Test plan is not quite correct) and the components to be used, but the online documentation is not so bad.
However, while playing around I have felt the need to create some monitoring scripts (n.b. I am still working on this part). JMeter offers support for BSF and BSH out of the box, but having in mind the release of Groovy 1.0 I thought to try to add Groovy support to JMeter.
So, last night, armed with the Groovy intro chapter from The Definitive Guide to Grails and Groovy in Action [note], I have started my attempt. The task wasn't easy, but not because of some obvious reasons: different parts of JMeter are using different approaches (like being contributed by completely unrelated people that never looked at the existing code), so deciding how should I write it took me a while. However, in a couple of hours I am having an working version: 2 main classes that are reused for different UI parts and respectively for Groovy integration, an interface to allow extensions and a couple of almost empty classes for each component : PreProcessor, PostProcessor, Listener and Sampler. Total size: 12 classes, aprox. 300 usefull LOC, cca. 500 TLOC. The UI is not so nice but follows the existing JMeter UI (I haven't done any GUI work in the last couple of years so I am a bit rusty [smile/]). After doing this job, I think most pieces are pretty reusable so integrating other scripting solution like JRuby or even the JDK6 scripting support would be a very easy task.
I am thinking to contribute this code to either JMeter or a Groovy module, but I still need to decide. Meanwhile, let me know if you are interested in this integration.
PS: I am still wondering how can I get my hands on any of the Manning books. I have pinged them a couple of times, submitted a complaint but never heard back from them.
Update: thanks to Dierk Koenig (author of Groovy in Action) and Olivia (from Manning) the above problem seems to start having a solution. Thanks.
11 comments:
Hello:
I'm sorry you have had trouble getting in touch with us. Please email me, Olivia, mkt at sign manning.com and I'll be happy to assist you.
Thanks,
Olivia
Manning Publications
How about a TestNG Sampler?. that will be really cool.
I'm thinking that I'm spending all this time writing unittests. Why not use the unittests for load and/or performance testing?.
Have you decided if you are going to make the groovy integration code public?
Hello Alexandru,
What a good idea !
I think real test tool must have a script language.
I know very well professional test software like Mercury LoadRunner (i'm certifiate and i have license in my PC) or open sofware like OpenSta.
I'm waiting a script language for JMeter with Groovy in 1.0.
I think it's a good choice to make a script possibility for JMeter.
I can be a beta tester.
Vincent DABURON (vdaburon[----] at [----] gmail [----] dot [----] com
(for second comment)
I am not sure what exactly do you mean by unit tests for load/performance testing. These are different, even if not radically. I would be interested to hear more.
(3rd comment)
Thanks Vincent. JMeter is already supporting 2 scripting engines (BSF and BSH), but I thought to add support for Groovy as I am not very aware of the status of the mentioned projects.
For the moment, I don't think I am ready to distribute the code, but I will keep it in mind for the near future.
./alex
--
.w( the_mindstorm )p.
Second comment guy:
Look at JMeter JUnit sampler. I'm not using JUnit, I'm using TestNG that's why I asked about a possible TestNG sampler.
What i have in mind is this: let's say i have a TestNG group called "loadtest", part of which I have tests written in such a way that is exercising an entire feature and/or API call, whatever you have.
It's more like integration tests that can also be use for load test and/or performance test.
I did used LoadRunner in the past, it's a great tool, but I have a big problem with the fact that I have to maintain yet another set of scripts in a different language then the current one that I’m using all day long (java) plus that I need to learn another tool.
I'm pretty proficient in java and TestNG, why not leverage what I already know and have in order to accomplice the task of load/performance testing?.
I don’t know how good he JMeter JUnit sampler is, I never use it, but people seem to like it if jmeter mailing list traffic is any indication.
What do you think?. Is this making any sense?
I don’t want to be a nuisance but is there any particular reason why you can’t release the groovy sampler code?. I personally don’t care if the code is alpha quality, not complete and/or looks ugly.
Alin
Hi Alin!
I will start by saying that I haven't seen JUnit samplers (except the example on site), but I can imagine there may be some usefull scenarios.
Considering that TestNG is IMO better suited to functional/integration tests, what you are saying makes now a lot of sense. And considering that TestNG has a clear programmatical API to trigger its run this would be trivial. The only "issue" is that currently I am extremely busy, so I am not sure when I will get to it.
About releasing the Groovy support, there are mainly 2 reasons (both subjective): a) I haven't had enough time to play with it; b) I don't have time to manage the code. However, if you make me believe there is interest in it I will set up a project on Google Code and put everything there in the coming weeks.
Thanks for your comments,
./alex
--
.w( the_mindstorm )p.
Fair Trade Coffee is an organization that protects the laborers who work hard to bring you great coffee. Fair Trade Coffee is produced a bit differently from regular beans, but still ensures that the beans are of the highest caliber.
In the United States people drink a lot of coffee, from cappuccino to espresso. Most people couldn't face a day without their morning cup, but most people have no clue how coffee is made. Fair Trade Coffee helps bring information on this process to the many coffee drinkers in the U.S.
hi alex,
I would also be interested in your source.
BR,
~A
For more JMeter tips, check out LoadRunner-to-JMeter script converter on www.performancenegineer.com
This is an excellent idea. I would love to have groovy support in JMeter!
I've taken inspiration from Alex's idea and ran with it. I started an open source project (documentation soon) to run Groovy scripts in JMeter. Works well, but could use enhancements and polish. Take a look and give me feedback or ask me to add you as a contributor to the code. We want your contributions!
-Matthew McCullough, Ambient Ideas, LLC (matthewm@ambientideas.com)
Project page:
http://code.google.com/p/jmeter-groovy-sampler/
Post a Comment