Performance Test using TestNG

2,120 views
Skip to first unread message

Frank

unread,
Aug 22, 2012, 11:57:15 PM8/22/12
to testng...@googlegroups.com
Hi,

I am trying to do performance test using testng, doing some complex web requests(that is hardly maintainable in pure jmeter).

What I plan to do is:
1. for each thing I want to measure, create one test method and tag it with groups={"perfcounter"}
2. write a TestListener(maybe IInvokedMethodListener?) that logs down the test execution data somewhere once the test finishes

I was thinking someone should have done this before, but can't it after searching for a while, anyone done this before? Any suggestions/caveats?

--
Frank

Krishnan Mahadevan

unread,
Aug 23, 2012, 3:34:16 AM8/23/12
to testng...@googlegroups.com
Frank,
Incase you are looking for some help on getting started with Listeners, you can take a look at this post of mine : rationaleemotions.wordpress.com/2012/01/27/listen-to-what-i-have-to-say-about-testng-listeners/

Incase you have any specific questions, would appreciate if you could please elaborate more on that.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/yxQ7cnlx2XUJ.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Frank

unread,
Aug 23, 2012, 1:55:23 PM8/23/12
to testng...@googlegroups.com
Thanks for the link Krishnan.

I actually tried my self for all the listeners, it seems not possible to use these to calculate the performance of certain function calls: given I am using dataprovider to run the test method in parallel, all these listeners just get called once, so I can't get the Max/Min time spent on that function, even't can't get the average since I don't know how much data was provided in the listener.

I will try dependency injection, if it doesn't work i will fallback to jmeter + scripts.

--
Frank

Krishnan Mahadevan

unread,
Aug 23, 2012, 2:05:14 PM8/23/12
to testng...@googlegroups.com
Frank,
I think you can use 

http://testng.org/javadoc/org/testng/IInvokedMethodListener.html#afterInvocation(org.testng.IInvokedMethod,%20org.testng.ITestResult)

And obtain the time taken for the method to be executed by subtracting end time from start time from the ITestResult object. 

This method would be called for every invocation of a configuration method [@Beforexxx/@Afterxxx] and also @Test methods. 

So you would need to filter out only test methods and you should be able to achieve what you are looking for. I know for a fact that this would work fine in both parallel and sequential executions and also with dataprovider coupled test methods as well. 
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/IKqCC1I5TWUJ.

To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Jeff

unread,
Aug 23, 2012, 2:12:27 PM8/23/12
to testng...@googlegroups.com

I haven't tried using TestING for this as I've needed to scale beyond one client.  I'm using "The Grinder" and though can be a little clunky it works.   I can expose custom Java classes/methods to the Jython scripts.

Frank

unread,
Aug 27, 2012, 1:34:06 AM8/27/12
to testng...@googlegroups.com
Thanks all. I end up writing my own perf test utils, which spawn threads that calls same function for certain times in each thread(with one parameter), and count the min/max/avg when it's done.

The performance test util code here in case you are interested: http://fayaa.com/code/view/27188/raw/

--
Frank
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply all
Reply to author
Forward
0 new messages