You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Darren Hartford <dh...@ghsinc.com> on 2004/04/07 16:44:25 UTC

Junitperf on Cactus/Maven

Hey all,
Sharing my experience and looking for some feedback.

I have successfully used JunitPerf on top of the cactus-maven-plugin.  Unfortunately, the results give me some doubt (the timed measures seem too sporadic) and I am hoping some of you more active testers could test and give your feedback to share with the rest of us less experienced testers on how to do performance/stress in-container testing.  =-)


Here is some sample code to get people rolling:

===code===
public class SimplePerfTestCase extends ServletTestCase {
	public SimplePerfTestCase(String name) {
		super(name);
	}
	
	public static Test suite() {
	      TestSuite suite = new TestSuite();
	      suite.addTest(simpleLoadTest(5, 10, "testNothing"));
	      return suite;
	}

	public void testNothing(){
	  	assertTrue(true);
	}

    public void setUp(){}
    public void tearDown(){}

    private static Test simpleLoadTest(int users, int iterations, String testMethod) {
    	//if average is more than 2 seconds (per user/iteration), fail
            long maxElapsedTime = (2000 * users * iterations);
    
	        Test testCase = new SimplePerfTestCase(testMethod);
	        Test loadTest = new LoadTest(testCase, users, iterations);
              Test timedTest = new TimedTest(loadTest, maxElapsedTime);
    
	        return timedTest;
      }
}
===code===

Unfortunately, I'm not sure how to extend the results to a report plugin in Maven for the site generation task, but that's step two if this would accurately measure performance.
-D

RE: Junitperf on Cactus/Maven

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Darren,

Performing performance unit tests with Cactus is one area I'd also like
Cactus going into. However, I've not researched it yet. I remember this
page talking about this too: http://www.kimble.co.uk/papers/grinder.htm

I haven't run your code yet (I plan to). Have you been able to trace why
some calls take longer? Is it related to Cactus or to the app server?
Does it do this on the different containers?

The only issue I can see with Cactus would be if you run several tests
in parallel (that would cause problems because test results would
overwrite each other). But I don't think this is what you're doing.

WRT Maven reports: the results are the standard JUnit results, right? So
I guess the standard stylesheet would work. However I'm sure it can be
improved. It would be quite easy to provide an additional property of
the Maven Cactus plugin that allows to use the styledir attribute of the
junitreport task.

Thanks
-Vincent

> -----Original Message-----
> From: Darren Hartford [mailto:dhartford@ghsinc.com]
> Sent: 07 April 2004 16:44
> To: Cactus Users List
> Subject: Junitperf on Cactus/Maven
> 
> Hey all,
> Sharing my experience and looking for some feedback.
> 
> I have successfully used JunitPerf on top of the cactus-maven-plugin.
> Unfortunately, the results give me some doubt (the timed measures seem
too
> sporadic) and I am hoping some of you more active testers could test
and
> give your feedback to share with the rest of us less experienced
testers
> on how to do performance/stress in-container testing.  =-)
> 
> 
> Here is some sample code to get people rolling:
> 
> ===code===
> public class SimplePerfTestCase extends ServletTestCase {
> 	public SimplePerfTestCase(String name) {
> 		super(name);
> 	}
> 
> 	public static Test suite() {
> 	      TestSuite suite = new TestSuite();
> 	      suite.addTest(simpleLoadTest(5, 10, "testNothing"));
> 	      return suite;
> 	}
> 
> 	public void testNothing(){
> 	  	assertTrue(true);
> 	}
> 
>     public void setUp(){}
>     public void tearDown(){}
> 
>     private static Test simpleLoadTest(int users, int iterations,
String
> testMethod) {
>     	//if average is more than 2 seconds (per user/iteration), fail
>             long maxElapsedTime = (2000 * users * iterations);
> 
> 	        Test testCase = new SimplePerfTestCase(testMethod);
> 	        Test loadTest = new LoadTest(testCase, users,
iterations);
>               Test timedTest = new TimedTest(loadTest,
maxElapsedTime);
> 
> 	        return timedTest;
>       }
> }
> ===code===
> 
> Unfortunately, I'm not sure how to extend the results to a report
plugin
> in Maven for the site generation task, but that's step two if this
would
> accurately measure performance.
> -D
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org