CHAPTER 5 PERFORMANCE (Web hosting bandwidth) THROUGH THE APPLICATION DEVELOPMENT

CHAPTER 5 PERFORMANCE THROUGH THE APPLICATION DEVELOPMENT LIFE CYCLE public void testSD() { assertEquals( 3.03, this.sampleHeap.getStandardDeviation(), 0.01 ); } public void testVariance() { assertEquals( 9.17, this.sampleHeap.getVariance(), 0.01 ); } public void testDataPointCount() { assertEquals( 10, this.sampleHeap.getDataPoints().size() ); } } In Listing 5-1, you can see that the DataPoint class, in addition to maintaining the observed value for a point in time, supports minimum and maximum values for the time period, computes the range, and supports scaling and adding data points. The sample test case creates a DataPoint object in the setUp() method and then exercises each piece of functionality. Listing 5-2 shows the test case for the Metric class. The Metric class aggregates the DataPoint objects and provides access to the collective minimum, maximum, average, range, standard deviation, and variance. In the setUp() method, the test creates a set of data points and builds the metric to contain them. Each subsequent test case uses this metric and validates values computed by hand to those computed by the Metric class. Listing 5-3 rolls both of these test cases into a test suite that can be executed as one test. Listing 5-3. MetricTestSuite.java package com.javasrc.metric; import junit.framework.Test; import junit.framework.TestSuite; public class MetricTestSuite { public static Test suite() { TestSuite suite = new TestSuite(); suite.addTestSuite( DataPointTest.class ); suite.addTestSuite( MetricTest.class ); return suite; } } A TestSuite exercises all tests in all classes added to it by calling the addTestSuite() method. A TestSuite can contain TestCases or TestSuites, so once you build a suite of test cases for your classes, a master test suite can include your suite and inherit all of your test cases.
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Leave a Reply