Java Doc for TimedTest.java in  » Testing » JUnitPerf » com » clarkware » junitperf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » JUnitPerf » com.clarkware.junitperf 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


junit.extensions.TestDecorator
   com.clarkware.junitperf.TimedTest

TimedTest
public class TimedTest extends TestDecorator (Code)
The TimedTest is a test decorator that runs a test and measures the elapsed time of the test.

A TimedTest is constructed with a specified maximum elapsed time. By default, a TimedTest will wait for the completion of its decorated test and then fail if the maximum elapsed time was exceeded. Alternatively, a TimedTest can be constructed to immediately signal a failure when the maximum elapsed time of its decorated test is exceeded. In other words, the TimedTest will not wait for its decorated test to run to completion if the maximum elapsed time is exceeded.

For example, to decorate the ExampleTest as a TimedTest that waits for the ExampleTest test case to run to completion and then fails if the maximum elapsed time of 2 seconds is exceeded, use:

 Test timedTest = new TimedTest(new TestSuite(ExampleTest.class), 2000);
 
or, to time a single test method, use:
 Test timedTest = new TimedTest(new ExampleTest("testSomething"), 2000);
 

Alternatively, to decorate the ExampleTest.testSomething() test as a TimedTest that fails immediately when the maximum elapsed time of 2 seconds is exceeded, use:

 Test timedTest = new TimedTest(new ExampleTest("testSomething"), 2000, false);
 


author:
   Mike Clark
author:
   Clarkware Consulting, Inc.
author:
   Ervin Varga



Constructor Summary
public  TimedTest(Test test, long maxElapsedTime)
     Constructs a TimedTest to decorate the specified test with the specified maximum elapsed time.
public  TimedTest(Test test, long maxElapsedTime, boolean waitForCompletion)
     Constructs a TimedTest to decorate the specified test with the specified maximum elapsed time.

Method Summary
public  intcountTestCases()
     Returns the number of tests in this timed test.
protected  longgetElapsedTime(long beginTime)
    
public  booleanoutOfTime()
     Determines whether the maximum elapsed time of the test was exceeded.
protected  voidprintElapsedTime(long elapsedTime)
    
public  voidrun(TestResult result)
     Runs the test.
protected  voidrunUntilTestCompletion(TestResult result)
     Runs the test until test completion and then signals a failure if the maximum elapsed time was exceeded.
protected  voidrunUntilTimeExpires(TestResult result)
     Runs the test and immediately signals a failure when the maximum elapsed time is exceeded.
public  voidsetQuiet()
     Disables the output of the test's elapsed time.
public  StringtoString()
     Returns the test description.


Constructor Detail
TimedTest
public TimedTest(Test test, long maxElapsedTime)(Code)
Constructs a TimedTest to decorate the specified test with the specified maximum elapsed time.

The TimedTest will wait for the completion of its decorated test and then fail if the maximum elapsed time was exceeded.
Parameters:
  test - Test to decorate.
Parameters:
  maxElapsedTime - Maximum elapsed time (ms).




TimedTest
public TimedTest(Test test, long maxElapsedTime, boolean waitForCompletion)(Code)
Constructs a TimedTest to decorate the specified test with the specified maximum elapsed time.
Parameters:
  test - Test to decorate.
Parameters:
  maxElapsedTime - Maximum elapsed time (ms).
Parameters:
  waitForCompletion - true (default) to indicate that the TimedTest should wait for its decorated test to run to completion and then fail if the maximum elapsed time was exceeded; false to indicate that the TimedTest should immediately signal a failure when the maximum elapsed time is exceeded.




Method Detail
countTestCases
public int countTestCases()(Code)
Returns the number of tests in this timed test. Number of tests.



getElapsedTime
protected long getElapsedTime(long beginTime)(Code)



outOfTime
public boolean outOfTime()(Code)
Determines whether the maximum elapsed time of the test was exceeded. true if the max elapsed timewas exceeded; false otherwise.



printElapsedTime
protected void printElapsedTime(long elapsedTime)(Code)



run
public void run(TestResult result)(Code)
Runs the test.
Parameters:
  result - Test result.



runUntilTestCompletion
protected void runUntilTestCompletion(TestResult result)(Code)
Runs the test until test completion and then signals a failure if the maximum elapsed time was exceeded.
Parameters:
  result - Test result.



runUntilTimeExpires
protected void runUntilTimeExpires(TestResult result)(Code)
Runs the test and immediately signals a failure when the maximum elapsed time is exceeded.
Parameters:
  result - Test result.



setQuiet
public void setQuiet()(Code)
Disables the output of the test's elapsed time.



toString
public String toString()(Code)
Returns the test description. Description.



Fields inherited from junit.extensions.TestDecorator
protected Test fTest(Code)(Java Doc)

Methods inherited from junit.extensions.TestDecorator
public void basicRun(TestResult result)(Code)(Java Doc)
public int countTestCases()(Code)(Java Doc)
public Test getTest()(Code)(Java Doc)
public void run(TestResult result)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.