JaVa
   

Load Testing with JUnitPerf

Overview

As part of the planning phase of any project, you should be given performance criteria for the completed system. By using JUnitPerf to decorate your existing JUnit test cases, you can ensure that your system meets its performance criteria. For example, you can test each Web page to ensure that it loads in 10 seconds or less and that the average load time is less than 5 seconds while the site is handling 1,000 concurrent users. JUnitPerf 1.9 is the latest release. It requires the use of Java 2 and JUnit 3.2 or higher. JUnitPerf consists of a small set of test decorators and related classes that extend the JUnit API; thus JUnitPerf tests extend a JUnit test by using the decorator pattern. You must have pre-existing JUnit tests to use JUnitPerf. JUnitPerf allows you to easily load tests and have tests fail if they do not respond in a certain time. You should be judicious in deciding when to use JUnitPerf. Using JUnitPerf to test every line of code is usually time-consuming and unnecessary. JUnitPerf is most effective in situations where you have specific performance criteria to meet. It is often a good idea to first use a performance-profiling tool, such as JProbe, to identify areas of code that have the highest potential for scalability and performance issues. Then you can focus your JUnitPerf tests on those relatively few bottleneck class methods. You can use JUnitPerf in conjunction with HttpUnit and JMeter to test performance of a Web site under load. For example, write a set JUnit test that uses HttpUnit tests that simulate a user navigating to a product in a Web catalog. Use JMeter to flood the site with requests, while you run a navigation test under a JUnitPerf timed test and set the test to fail if it does not navigate the site to the product page in 15 seconds.

Java Start Sidebar
Where To Get JUnitPerf

JUnitPerf was developed by Mike Clark from Clarkware Consulting, Inc. and is distributed under the BSD license. You can download JUnitPerf at www.clarkware.com/software/JUnitPerf.html.

Java End Sidebar

JaVa
Comments