140 CHAPTER 5 PERFORMANCE (Best web hosting) THROUGH THE APPLICATION

140 CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION DEVELOPMENT LIFE CYCLE The final step in this example is to execute either an individual test case or a test suite. After downloading JUnit from www.junit.org, add the junit.jar file to your CLASSPATH and then invoke either its command-line interface or GUI interface. The three classes that execute these tests are as follows: junit.textui.TestRunner junit.swingui.TestRunner junit.awtui.TestRunner And as these package names imply, textui is the command-line interface and swinguiis the graphical interface. awtui provides a batch interface to executing unit tests. You can pass an individual test case or an entire test suite as an argument to the TestRunner class. For example, to execute the test suite that we created earlier, you would use this: java junit.swingui.TestRunner com.javasrc.metric.MetricTestSuite Unit Performance Testing Unit performance testing has three aspects: Memory profiling Code profiling Coverage profiling This section explores each facet of performance profiling. I provide examples of what to look for and the step-by-step process to implement each type of testing. Memory Profiling Let s first look at memory profiling. To illustrate how to determine if you do, in fact, have a memory leak, I modified the BEA MedRec application to capture the state of the environment every time an administrator logs in and to store that information in memory. My intent is to demonstrate how a simple tracking change left to its own devices can introduce a memory leak. The steps you need to perform on your code for each use are as follows: 1. Request a garbage collection and take a snapshot of your heap. 2. Perform your use case. 3. Request a garbage collection and take another snapshot of your heap. 4. Compare the two snapshots (the difference between them includes all objects remaining in the heap) and identify any unexpected loitering objects. 5. For each suspect object, open the heap snapshot and track down where the object was created.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision shared web hosting services

Leave a Reply