~ubuntu-branches/ubuntu/quantal/junitperf/quantal

« back to all changes in this revision

Viewing changes to samples/com/clarkware/junitperf/ExampleTimedTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Takashi Okamoto
  • Date: 2003-05-03 13:51:04 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20030503135104-g65uwm06z7rebnb1
Tags: 1.8-1
* New upstream release.
* close wishlist for ver1.8.(closes:#191565)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.clarkware.junitperf;
 
2
 
 
3
import junit.framework.Test;
 
4
import junit.framework.TestSuite;
 
5
 
 
6
/**
 
7
 * The <code>ExampleTimedTest</code> demonstrates how to decorate a 
 
8
 * <code>Test</code> as a <code>TimedTest</code>.
 
9
 *
 
10
 * @author <a href="mailto:mike@clarkware.com">Mike Clark</a>
 
11
 * @author <a href="http://www.clarkware.com">Clarkware Consulting, Inc.</a>
 
12
 *
 
13
 * @see com.clarkware.junitperf.TimedTest
 
14
 */
 
15
 
 
16
public class ExampleTimedTest {
 
17
 
 
18
        public static final long toleranceInMillis = 100;
 
19
 
 
20
        public static Test suite() {
 
21
                
 
22
                long maxElapsedTimeInMillis = 1000 + toleranceInMillis;
 
23
 
 
24
                Test testCase = new ExampleTestCase("testOneSecondResponse");
 
25
                Test timedTest = new TimedTest(testCase, maxElapsedTimeInMillis);
 
26
 
 
27
                TestSuite suite = new TestSuite();
 
28
                suite.addTest(timedTest);
 
29
 
 
30
                return suite;
 
31
        }
 
32
 
 
33
        public static void main(String args[]) {
 
34
                junit.textui.TestRunner.run(suite());
 
35
        }
 
36
}