|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.junit.extensions.listeners.CSVTestListener
public class CSVTestListener
CSVTestListener is both a test listener, a timings listener, a memory listener and a parameter listener. It listens for test completion events and then writes out all the data that it has listened to into a '.csv' (comma seperated values) file.
Responsibilities | Collaborations |
---|---|
Listen to test events; start, end, fail, error. | |
Listen to test timings. | |
Listen to test memory usage. | |
Listen to parameterized test parameters. | |
Output all test data to a CSV file. |
Field Summary | |
---|---|
(package private) Map<Long,org.apache.qpid.junit.extensions.listeners.CSVTestListener.TestResult> |
threadLocalResults
Map for holding results on a per thread basis as they come in. |
Constructor Summary | |
---|---|
CSVTestListener(Writer writer)
Creates a new CSVTestListener object. |
Method Summary | |
---|---|
void |
addError(junit.framework.Test test,
Throwable t)
Called when a test results in an error. |
void |
addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError t)
Called when a test results in a failure. |
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)
Takes a time stamp for the end of the batch to calculate the total run time. |
void |
endTest(junit.framework.Test test)
Called when a test completes. |
void |
endTest(junit.framework.Test test,
Long threadId)
Called when a test completes. |
Thread |
getShutdownHook()
Supplies the shutdown hook. |
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, test passed. |
void |
startBatch()
Takes a time stamp for the beginning of the batch and resets stats counted for the batch. |
void |
startTest(junit.framework.Test test)
Called when a test starts. |
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 |
---|
Map<Long,org.apache.qpid.junit.extensions.listeners.CSVTestListener.TestResult> threadLocalResults
Constructor Detail |
---|
public CSVTestListener(Writer writer)
writer
- A writer where this CSV listener should write out its output to.Method Detail |
---|
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 addError(junit.framework.Test test, Throwable t)
addError
in interface junit.framework.TestListener
test
- The test which is in error.t
- Any Throwable raised by the test in error.public void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)
addFailure
in interface junit.framework.TestListener
test
- The test which failed.t
- The AssertionFailedError that encapsulates the test failure.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 endTest(junit.framework.Test test)
endTest
in interface junit.framework.TestListener
test
- The test which completed.public void startTest(junit.framework.Test test)
startTest
in interface junit.framework.TestListener
test
- The test wich has started.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 startBatch()
startBatch
in interface TKTestListener
public void endBatch(Properties parameters)
endBatch
in interface TKTestListener
parameters
- The optional test parameters, may be null.public void properties(Properties properties)
properties
in interface TKTestListener
properties
- The tests read/set properties.public Thread getShutdownHook()
getShutdownHook
in interface ShutdownHookable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |