|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.junit.extensions.listeners.ConsoleTestListener
public class ConsoleTestListener
ConsoleTestListener provides feedback to the console, as test timings are taken, by drawing a '.', or an 'E', or an 'F', for each test that passes, is in error or fails. It does this for every test result registered with the framework, not just on the completion of each test method as the JUnit one does. It also uses a throttle to cap the rate of dot drawing, as exessively high rates can degrade test performance without providing much usefull feedback to the user. Unlike the JUnit dot drawing feedback, this one will correctly wrap lines when tests are run concurrently (the rate capping ensures that this does not become a hot-spot for thread contention).
Where rate capping causes the conflation of multiple requested dots into a single dot, the dot that is actually drawn will be the worst result within the conflation period, that is, error is worse than fail which is worse than pass.Responsibilities | Collaborations |
---|---|
Draw dots as each test result completes, at a capped rate. |
Field Summary | |
---|---|
(package private) Throttle |
throttle
Used to throttle the dot writing rate. |
Constructor Summary | |
---|---|
ConsoleTestListener()
Creates a dot drawing feedback test listener, set by default to 80 columns at 80 dots per second capped rate. |
Method Summary | |
---|---|
void |
addError(junit.framework.Test test,
Throwable t)
An error occurred. |
void |
addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError t)
A failure occurred. |
void |
addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError e,
Long threadId)
Called when a test completes to mark it as a test fail. |
void |
concurrencyLevel(junit.framework.Test test,
int threads,
Long threadId)
Should be called every time a test completes with the current number of test threads running. |
void |
endBatch(Properties parameters)
Notifies listeners of the end of a complete run of tests. |
void |
endTest(junit.framework.Test test)
A test ended. |
void |
endTest(junit.framework.Test test,
Long threadId)
Called when a test completes. |
void |
memoryUsed(junit.framework.Test test,
long memStart,
long memEnd,
Long threadId)
Should be called every time a test completed with the amount of memory used before and after the test was run. |
void |
parameterValue(junit.framework.Test test,
int parameter,
Long threadId)
Should be called every time a parameterized test completed with the int value of its test parameter. |
void |
properties(Properties properties)
Notifies listeners of the tests read/set properties. |
void |
reset(junit.framework.Test test,
Long threadId)
Resets the test results to the default state of time zero, memory usage zero, parameter zero, test passed. |
void |
startBatch()
Notifies listeners of the start of a complete run of tests. |
void |
startTest(junit.framework.Test test)
A test started. |
void |
timing(junit.framework.Test test,
long nanos,
Long threadId)
Should be called every time a test completes with the run time of that test. |
void |
timing2(junit.framework.Test test,
Long nanos,
Long threadId)
Optionally called every time a test completes with the second timing test. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Throttle throttle
Constructor Detail |
---|
public ConsoleTestListener()
Method Detail |
---|
public void addError(junit.framework.Test test, Throwable t)
addError
in interface junit.framework.TestListener
test
- The test in error. Ignored.t
- The error that the test threw. Ignored.public void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)
addFailure
in interface junit.framework.TestListener
test
- The test that failed. Ignored.t
- The assertion failure that the test threw. Ignored.public void endTest(junit.framework.Test test)
endTest
in interface junit.framework.TestListener
test
- The test that ended. Ignored.public void startTest(junit.framework.Test test)
startTest
in interface junit.framework.TestListener
test
- The test that started. Ignored.public void reset(junit.framework.Test test, Long threadId)
reset
in interface TKTestListener
test
- The test to resest any results for.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void timing(junit.framework.Test test, long nanos, Long threadId)
timing
in interface TKTestListener
test
- The name of the test.nanos
- The run time of the test in nanoseconds.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void timing2(junit.framework.Test test, Long nanos, Long threadId)
timing2
in interface TKTestListener
test
- The name of the test.nanos
- The second timing information of the test in nanoseconds.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void memoryUsed(junit.framework.Test test, long memStart, long memEnd, Long threadId)
memoryUsed
in interface TKTestListener
test
- The test which memory was measured for.memStart
- The total JVM memory used before the test was run.memEnd
- The total JVM memory used after the test was run.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void parameterValue(junit.framework.Test test, int parameter, Long threadId)
parameterValue
in interface TKTestListener
test
- The test which memory was measured for.parameter
- The int parameter value.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void concurrencyLevel(junit.framework.Test test, int threads, Long threadId)
concurrencyLevel
in interface TKTestListener
test
- The test for which the measurement is being generated.threads
- The number of tests being run concurrently.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void endTest(junit.framework.Test test, Long threadId)
endTest
in interface TKTestListener
test
- The test which completed.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError e, Long threadId)
addFailure
in interface TKTestListener
test
- The test which failed.e
- The assertion that failed the test.threadId
- Optional thread id if not calling from thread that started the test method. May be null.public void startBatch()
startBatch
in interface TKTestListener
public void endBatch(Properties parameters)
endBatch
in interface TKTestListener
parameters
- The optional test parameters to log out with the batch results.public void properties(Properties properties)
properties
in interface TKTestListener
properties
- The tests read/set properties.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |